A place for Sharepoint and rantings
Email from friends (invsqrt)
Don’t you just love getting email from your friends. I am sure that as you read this you may think about past jokes and humerous anecdotes received.
I don’t get many like that, this is what I got from a friend of mine today,
How bout this for a fast invsqrt…
float InvSqrt(float x)
{
float xhalf = 0.5f * x;
int i = *(int *)&x;
i = 0x5f3759df – (i >> 1);
x = *(float *)&i;
x = x * (1.5f – xhalf * x * x);
return x;
}Explanation given here (not for the faint of heartr)
http://www.math.purdue.edu/~clomont/Math/Papers/2003/InvSqrt.pdf
You have to see the explanation and Steve’s right its not for the faint of heart.
So any XNA peeps who stumble along here might you be interested.
| Print article | This entry was posted by Binaryjam on December 15, 2006 at 8:51 am, and is filed under development. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
about 2 years ago
For a better explanation about this, check out http://www.mceniry.net/papers/Fast%20Inverse%20Square%20Root.pdf