You post a problem cobbled together from fragments you find on the net, and you praise yourself for being clever, You get upset if nobody thinks it is clever and act superior even though you got it from the net.
I will go back to not responding to your math problems.
Steve baby, my patience is wearing very thin. Your whines are ludicrous.
You do not know whom you are insulting.
I have published several peer-reviewed journal articles, two books and a newspaper column! I have over 30 U.S. patents. (That doesn't include foreign patents and CIPs.) I have scored 99.998 percentile on contests and standardized tests. Decades ago I was called "the best microprogrammer in Silicon Valley." If I mentioned specific bullets from my resume, Google or Wikipedia would quickly lead you to my real-life identity.
You, on the other hand, post code to print "Hello, world" -- or something equally trivial -- and marvel at it like a toddler who's been given a shiny new hammer.
Your posts about the problems I posed in this thread are non-sensical.
You construct lies about me. I'll show just one specific example:
Over two years ago or so I posted what I thought was an interesting way to multiply two non-negative numbers, a and b.
Back in the 20th-century I was a programmer with almost a fetish for time-efficient low-level code. Multiplication and division were often important bottlenecks. I'll content myself with just the most interesting example of what can be done:
Code:
#include <stdio.h>
#include <stdlib.h>
/* Use this approach when there is a smallish known bound on multiplier size */
#define BOUND 20000
unsigned int sq[BOUND * 4];
#define osq (sq + BOUND * 2)
/* This multiplier is FASTER than '*' on almost all processors without special assist */
int mult(int a, int b)
{
return osq[a + b] - osq[a - b];
}
int main(int argc, char **argv)
{
int a, b;
/* Setup sq table */
for (a = 0; a < BOUND * 2; a++)
osq[-a] = osq[a] = a * a / 4;
/* Verify mult() works by testing every case */
for (a = 0; a < BOUND; a++)
for (b = 0; b < BOUND; b++)
if (a * b != mult(a, b))
printf("Mult failed at %d %d\n", a, b);
exit(0);
}
Do you see the cute algebraic trick at work here? I have verified that
when it is applicable, this code often outperforms a 'normal' multiply. (The example code assumes a,b non-negative, but can be adapted to support negative numbers also.)
BTW, the Intel 80x86 has a single-instruction multiply by 5:
leal (%eax,%eax,4), %eax. The Motorola 680xx has a similar instruction.
In my opinion, this is a VERY interesting technique. It should be fun to think about EVEN IF USELESS. Comments:
- As I noted in a follow-up, it was apparently the multiplication method used in ancient Babylon!! (They couldn't use an ordinary multiplication table -- it would have to be 60x60 instead of 10x10.)
- Although I invented the SPECIFIC method, I claim no credit. It was inspired by a journal article reported by a colleague. A similar method may have been invented by John von Neumann himself.
- It's even "niftier" than it may appear at first glance. No rounding or other special handling is required. The simple "osq[-a] = osq[a] = a * a / 4" and "osq[a + b] - osq[a - b]" work AS IS. (This is because 3 is not a quadratic residue of 4.)
- Please note that I stated in this very first post on the subject that the code, where applicable, was faster than ordinary multiplication only on processors WITHOUT SPECIAL ASSIST.
- In fact by the 1990s or even earlier almost all processors used where speed was important did have special assistance, e.g. for multiplication.
- But not all did. In particular the early Sun Sparcstations delivered by SMI DID multiply significantly faster with my code. I don't know when SMI started delivering faster processors, but my tests were done on DELIVERED machines when I consulted for a Sun customer, and NOT while I was a consultant for Sun.
As I suggest, the code should be viewed as Nifty, even if useless. I was disappointed when nobody seemed interested.
Your response was:
... I'll content myself with just the most interesting example of what can be done:
...
It is just a freaking exercise.
All processors had/have signed and unsigned integer addition ADD ADDC, and hardware
Okay. Whatever.
Later you doubled-down with a prevarication:
Swammerdami said:
Anybody can have a brain fart. Yiu are cstently shallow and lacjing comreension.
From your posts over time my guess is that you never word with people who had the savy to ubdertsnd what you did and quetion it. When somebody did you prbably bluff yir way though it.
I've posted synopses of my career. At my last job I worked with one of the top pattern-recognition scientists in the USA. We coauthored papers and coauthored patent applications. I've worked with many other top engineers. Sometimes a stranger would approach and ask for help since they'd heard I was the best mathematician in the (large) company. Et cetera. Evidently you think what I tell about myself is a lie. You think you've caught me "bluffing."
Down the thread you posted a multiply algorithm you said was faster the anything else. I showed it to be false and when I asked you about limitations of the code you went silent.
I think you're referring to the Babylonian approach using a table of squares. I NEVER said it was "faster than anything else." I DID mention that it outperformed the standard multiply on SOME 20th-century machines (without FPU obviously), though there is a storage-vs-speed tradeoff.
-- -- -- -- -- --
I also posted an elegant snippet that converts two uniform real variates into a 2D gaussian variate in polar coordinates, and then converts that into two INDEPENDENT 1D gaussian variates. This is thought to be the fastest way to generate 1D gaussian variates.
Again nobody seemed interested. :-( Except you, who didn't even understand what a 2D gaussian variate was, and took the opportunity to deliver a 3rd grade-level lecture on what you vaguely remember about random numbers.
Recently, as an exercise you published here a program to print "Hello world" or some such. Recently I had fun writing a problem to determine what combination of cards and plays produces the highest cribbage score, (Dealer hand + Crib + Dealer Pegging - Pone hand - Pone pegging). Maybe I'll publish the source here. You're welcome to Google if you think I lifted it from the 'Net.
Better yet, why don't you try to write some program even one-twentieth as complicated as my cribbage program. (No, we don't need a Revision 2 of your recent effort that prints "Good-day world" after the "Hello.")