Better `rsqrt`

Better `rsqrt`

Mod

Replaces the constants Minecraft uses for their functions for calculating the reciprocal square root (aka rsqrt) with more accurate alternatives

Client or server Utility

284 downloads
9 followers
Follow Save
Host your Minecraft server on BisectHosting - get 25% off your first month with code MODRINTH.

Better rsqrt

N.B.: The accuracy benefits of this is negligible at best, so don't expect anything big to happen. This is created purely because I want to, and I can.

Tested to work every version since 1.14 (v1.0.1)

Replaces the constant Minecraft uses in their fast reciprocal square root (also known as InvSqrt or rsqrt) functions, to yield better accuracy:

Function Original Value More Accurate™ Value
fastInverseSqrt(float) 0x5f3759df 0x5f375a86
fastInverseSqrt(double) 0x5fe6eb50c7b537aa 0x5fe6eb50c7b537a9

Since Minecraft only use these functions in rendering, this "fix" should not affect world generation or other functions that rely on the vanilla result to yield expected results.

References

Both accessed on June 13th, 2021:


Project members

pluie

Owner

Details

Licensed CC0-1.0
Published 3 years ago
Updated 3 years ago