We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d535089 commit f6d637eCopy full SHA for f6d637e
src/engine/qcommon/q_shared.h
@@ -349,7 +349,9 @@ extern const quat_t quatIdentity;
349
_mm_store_ss( &y, _mm_rsqrt_ss( _mm_load_ss( &number ) ) );
350
#else
351
float x = 0.5f * number;
352
- float y = Util::bit_cast<float>( 0x5f3759df - ( Util::bit_cast<uint32_t>( number ) >> 1 ) );
+ // Original value: 0x5f3759df
353
+ // Better value comes from: http://rrrola.wz.cz/inv_sqrt.html
354
+ float y = Util::bit_cast<float>( 0x5f1ffff9 - ( Util::bit_cast<uint32_t>( number ) >> 1 ) );
355
// initial iteration
356
// relative error bound after the initial iteration: 1.8 * 10^-3
357
y *= ( 1.5f - ( x * y * y ) );
0 commit comments