[clug] Code Search

Paul TBBle Hampson Paul.Hampson at Pobox.com
Mon Oct 9 00:03:53 GMT 2006


On Mon, Oct 09, 2006 at 09:33:43AM +1000, Alex Satrapa wrote:
> On 7 Oct 2006, at 14:00, Paul TBBle Hampson wrote:

> >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

No, I meant the whole area of approximating zeroes.

http://en.wikipedia.org/wiki/Newton-Raphson

Even the example given in your linked article uses it for something
other than inverse square roots. ^_^

> 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.

If you feed the first half of the constant into Google code search, you
can see people who've been tweaking it further, even in one case going
so far as to redefine the "1.5" into something with eight decimal
places.

-- 
-----------------------------------------------------------
Paul "TBBle" Hampson, B.Sc, LPI, MCSE
On-hiatus Asian Studies student, ANU
The Boss, Bubblesworth Pty Ltd (ABN: 51 095 284 361)
Paul.Hampson at Pobox.Com

Of course Pacman didn't influence us as kids. If it did,
we'd be running around in darkened rooms, popping pills and
listening to repetitive music.
 -- Kristian Wilson, Nintendo, Inc, 1989

License: http://creativecommons.org/licenses/by/2.1/au/
-----------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.samba.org/archive/linux/attachments/20061009/72a7ba8a/attachment.bin


More information about the linux mailing list