License Public Domain
Lines 8
Keywords
doom (1)
Permissions
Group Owner: Famous Code
Viewable by Everyone
Editable by All Siafoo Users
Hide
Bored? Check out the Recent Activity on Siafoo Join Siafoo Now or Learn More

Doom Inverse Square Root Function Atom Feed 3

In Brief Doom's semi famous inverse square root function, more info about it at: http://www.beyond3d.com/content/articles/8/
# '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/