Everything I know about the fast inverse square root algorithm

The author delves into the intricacies of the fast inverse square root algorithm popularized by John Carmack in Quake 3, exploring the clever manipulation and interpretation of float bit patterns to approximate $frac{1}{sqrt{x}}$. This algorithm was essential in the late ’90s for computing lighting and 3D vector calculations due to slow CPU processes. The author breaks down the raw bit representation of 32-bit floats and how they approximate log2(x). By creatively interpreting float bits as logarithms, the algorithm tricks the computer into performing complex operations using simple arithmetic. The mysterious “evil floating point bit level hacking” at the core of this code represents a revolutionary approach to fast computation. Controversially, the article disputes the optimality of the chosen values, adding an element of intrigue to the algorithm’s history.

https://github.com/francisrstokes/githublog/blob/main/2024%2F5%2F29%2Ffast-inverse-sqrt.md

To top