Fast inverse square root using fixed point instead of floating point

  approximation, c++, fixed-point, math

I am trying to implement Fast Inverse Square Root for a fixed point number, but I’m not getting anywhere.

I am trying to follow exactly the same principle as the article, except instead of writing the number in the floating point format x = (-1) ^ s * (1 + M) * 2 ^ (E-127), I am using the format x = M * 2 ^ -16, which is a 32-bit fixed point number with 16 decimal bits and 16 fractional bits.

The problem is that I cannot find the value of the "magic constant". According to my calculations, it doesn’t exist, but I’m not a mathematician and I think I’m doing everything wrong.

Source: Windows Questions C++

LEAVE A COMMENT