The fast inverse square root algorithm is probably best known for its use in Quake III Arena, the source code of which was released to the public a few years after its release. However, the algorithm was used much earlier than this - Wikipedia gives Gary Tarolli's implementation for the SGI Indigo as a possible earliest known use.
float fast_InvSqrt(float n) {
union {float f; long l;} approx = n
approx.l = 0x5f3759df - (approx.l >> 1); /* Fast inverse square root */
approx.f = y * (1.5F - (0.5f * n * approx.f * approx.f)); /* Newton's method */
return approx.f;
}
The Fast InvSqrt algorithm contains one or two iterations of Newton's method, but this question is asking mainly about the line approx.l = 0x5f3759df - (approx.l >> 1);
.
Who first developed Fast InvSqrt()? Where did 0x5f3759df
originally come from?