Created
February 3, 2022 12:02
-
-
Save mattroz/a972df23c1f4937867c49822b5c25247 to your computer and use it in GitHub Desktop.
Fast exponent in C++
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
inline float fast_exp(float x) | |
{ | |
union { | |
uint32_t i; | |
float f; | |
} v{}; | |
v.i = (1 << 23) * (1.4426950409 * x + 126.93490512f); | |
return v.f; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment