39 const double threehalfs = 1.5;
40 const double x2 = x * 0.5;
44 i = 0x5fe6eb50c7aa19f9ULL - ( i >> 1 );
46 for (uint32_t j=0;j<ISQRT_ITERATIONS;++j)
47 y *= threehalfs - ( x2 * y * y ) ;
70 const float threehalfs = 1.5f;
71 const float x2 = x * 0.5f;
74 i = 0x5f3759df - ( i >> 1 );
76 for (uint32_t j=0;j<ISQRT_ITERATIONS;++j)
77 y *= ( threehalfs - ( x2 * y * y ) );
double fast_isqrt_general(double x, const uint32_t ISQRT_ITERATIONS)
Sqrt implmentation from Quake3.
float uint322sp(int x)
Converts an int to a float.
uint32_t sp2uint32(float x)
Converts a float to an int.
static const double x2[5]
double fast_approx_isqrt(double x)
Three iterations.
float fast_isqrtf_general(float x, const uint32_t ISQRT_ITERATIONS)
Sqrt implmentation from Quake3.
float fast_isqrtf(float x)
Two iterations.
uint64_t dp2uint64(double x)
Converts a double to an unsigned long long.
double isqrt(double x)
For comparisons.
double uint642dp(uint64_t ll)
Converts an unsigned long long to a double.
float fast_approx_isqrtf(float x)
One (!) iterations.
float isqrtf(float x)
For comparisons.
double fast_isqrt(double x)
Four iterations.