Created
May 24, 2014 05:29
-
-
Save topokel/070e21799af58d41555e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| func FastInvSqrt(x float32) float32 { | |
| i := math.Float32frombits(0x5f3759df - math.Float32bits(x)>>1) | |
| return i * (1.5 - (x * 0.5 * i * i)) | |
| } | |
| func FastInvSqrt64(x float64) float64 { | |
| i := math.Float64frombits(0x5fe6eb50c7b537a9 - math.Float64bits(x)>>1) | |
| return i * (1.5 - (x * 0.5 * i * i)) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment