Solve a problem – Filter by language, license, keyword, owner, or search text to find code & info fast.
Join Siafoo Now
or
Learn More
Doom Inverse Square Root Function
| In Brief | Doom's semi famous inverse square root function, more info about it at: http://www.beyond3d.com/content/articles/8/ |
| Language | C |
# 's
1float InvSqrt (float x){
2 float xhalf = 0.5f*x;
3 int i = *(int*)&x;
4 i = 0x5f3759df - (i>>1);
5 x = *(float*)&i;
6 x = x*(1.5f - xhalf*x*x);
7 return x;
8}
Doom's semi famous inverse square root function, more info about it at: http://www.beyond3d.com/content/articles/8/
Add a Comment