Get the latest tech news
Everything I know about the fast inverse square root algorithm
I'm sick of complex blogging solutions, so markdown files in a git repo it is - francisrstokes/githublog
One of the key ideas behind this algorithm, and the reason this works, is because the raw bit pattern of a float, when interpreted as 32-bit signed integer, essentially approximates a scaled and shifted log2(x) function. If you take a series of evenly-spaced floating point numbers - say 256 of them - starting at 0, increasing by 0.25 each time, and interpret the bit pattern as an integer, you get the following graph: This is absolutely a solid, wel thought-out piece of engineering, employed to compute an expensive operation thousands of times per second on the under-powered hardware of the day.
Or read this on Hacker News