https://attackofthefanboy.com/articles/the-quake-iii-algorithm-that-defies-math-explained/
I know next to nothing about programming and physics, but I do know this article intrigues me. I’m mostly interested in how the algorithm “allowed the game to function faster and more smoothly,” and why it’s “seemingly mathematically impossible.”
In: 119
>allowed the game to function faster and more smoothly
You need to run this calculation a lot (once per surface, on every frame), so speed is paramount. Traditional division and root calculation is rather slow, while multiplication and addition are much faster on a computer. So by using this wacky algorithm, you get more frames per second with the same hardware.
>seemingly mathematically impossible
It (ab)uses the IEEE 754 format (which is a standard on how floating point numbers are represented in bits) in a way that wasn’t intended. Namely by interpreting the bits in a completely different way, a whole number. From this, you can calculate the logarithm of a number very easily by exploiting the properties of IEEE 754.
If you just look at what the formats are on paper, this seems impossible, because this conversion was never intended to be done in this way.
Latest Answers