Fast Inverse Square Root in Delphi's Object Pascal
January 9, 2021
Does Delphi make you a better programmer? Is Object Pascal code more readable?
There is an algorithm with a mystery constant that rose to fame in John Carmack’s Quake III Arena C code for quickly estimating the inverse square root of a 32-bit floating-point number.
float Q_rsqrt( float number )
{
long i;
float x2, y;
const float threehalfs = 1.5F;
x2 = number * 0.5F;
y =…