Fast inverse Square root
DesWurstes opened this issue ยท 3 comments
Are you sure? See: net.minecraft.util.math.MathHelper
public static float sqrt(double value)
{
return (float)Math.sqrt(value);
}
Also, please add a license to your project.
Yes, I'm sure. See: net.minecraft.util.math.MathHelper#fastInvSqrt
public static double fastInvSqrt(double p_181161_0_)
{
double d0 = 0.5D * p_181161_0_;
long i = Double.doubleToRawLongBits(p_181161_0_);
i = 6910469410427058090L - (i >> 1);
p_181161_0_ = Double.longBitsToDouble(i);
p_181161_0_ = p_181161_0_ * (1.5D - d0 * p_181161_0_ * p_181161_0_);
return p_181161_0_;
}
The algorithm only applies to inverse square roots, not regular ones.
It is licensed as you can see here.