Since everybody seems to be adding little additions to JOODE, here’s mine:
public static final float inverseSqrt( float value ) {
float xhalf = 0.5f * value;
int i = Float.floatToIntBits( value );
i = 0x5f375a86 - (i >> 1);
value = Float.intBitsToFloat( i );
value = value * ( 1.5f - xhalf * value * value );
return value;
}
That code as you probably know is from the Quake3 src code, however, my implementation has a different initial guess which is slightly more accurate over only 1 loop. Use this instead of the 1/Math.sqrt(…); in Real.normalize(), Vector3.normalize();
Edit, forgot to say, this only works on x86.
Enjoy