Last active
January 10, 2024 19:33
-
-
Save XProger/433701300086245e0583 to your computer and use it in GitHub Desktop.
fast powf function (IEEE-754 hack)
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 powf_fast(float a, float b) { | |
union { float d; int x; } u = { a }; | |
u.x = (int)(b * (u.x - 1064866805) + 1064866805); | |
return u.d; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment