Shared publicly  - 
 
After a discussion about the fast inverse square root function at the office my stubbornness pulled me into the rabbit hole of understanding how it works. This is the function that famously bit-casts a floating-point value to an int, does simple integer arithmetic, and then bit-casts the result back:

int i = * (int*)&x; // evil floating point bit level hacking
i = 0x5f3759df - (i >> 1); // what the fuck?
x = * (float*)&i;

This blog post is my tour of the rabbit hole that is FastInvSqrt.
17
41
Jasmine Hegman's profile photoBram Bout's profile photoAndré Medeiros's profile photo
3 comments
 
Awesome post - loved it!
 
What a fantastic, in-depth article! Thank you!
Add a comment...