Created
September 4, 2022 20:00
-
-
Save designerzen/11e655fa5e9d07eece4aed2307f50b22 to your computer and use it in GitHub Desktop.
Fastest inverse square root
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float inv_sqrt(float x) | |
{ union { float f; uint32 u; } y = {x}; | |
y.u = 0x5F1FFFF9ul - (y.u >> 1); | |
return 0.703952253f * y.f * (2.38924456f - x * y.f * y.f); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment