[clug] Code Search

Alex Satrapa grail at goldweb.com.au
Sun Oct 8 23:33:43 GMT 2006


On 7 Oct 2006, at 14:00, Paul TBBle Hampson wrote:

> == Bad word follows... ==
>
> I particularly liked
> http://www.google.com/codesearch?...
> which caused me to learn about the method of approximating zeroes. ^_^

Approximating inverse square roots, even ;)

http://www.codemaestro.com/reviews/review00000105.html

I'm now twitching to find a problem I can solve with the magic number:
> The results are very surprising – Lomont's well calculated  
> mathematically optimal constant [for the first approximation to the  
> inverse square root of any number] turns out to be slighltly  
> different (0x5f37642f) , and in spite of being theoretically  
> better, it yields worse results then the original constant used in  
> the source code!! Indeed, John Carmack must have used genuine black  
> magic to find this number.

The funny thing is, you can find people commenting on the code  
saying, "it's just a standard Newton-Raphson method" - totally  
oblivious to the fact that the number John Carmack's code monkey  
picked is better than what a mathematician found through mathematical  
methods. Poor code monkey must have been looking for that number for  
a long time.

Alex



More information about the linux mailing list