License Public Domain
Lines 8
Average
5.0
Rated
3
Times
5
4
3
2
1
0
Keywords
doom (1)
Permissions
Group Owner: Famous Code
Viewable by Everyone
Editable by All Siafoo Users
Hide
Writing an article is easy - try our reStructured Text demo Join Siafoo Now or Learn More

Doom Inverse Square Root Function Atom Feed

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/