Damus
Fabian Giesen profile picture
Fabian Giesen
@Fabian Giesen
OK everyone on here and following me probably already knows this but I want to get it off my chest anyway:

*please* stop attributing reciprocal-square-root-by-IEEE-bit-twiddling to John Carmack/Quake 3.

John has a lot of "firsts" under his belt but this is not one of them.

This trick is _old_. The magic constant changes, but the trick itself is _old_.

1993 versions of Sun's fdlibm already included this reproduction of W. Kahan and K. C. Ng's paper on the subject: https://github.com/freemint/fdlibm/blob/master/e_sqrt.c#L215
1
Fabian Giesen · 2w
That paper was never formally published (that I can track down anyhow) but note it has both regular and reciprocal square root versions (the latter on the way to computing a square root) as well as instructions for getting correctly rounded (=equivalent to doing the calculation exactly then rounding...