Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The Legendary Fast Inverse Square Root with "Voodoo Black Magic"

https://medium.com/hard-mode/the-legendary-fast-inverse-squa...



That one still kills me. By Carmack's comment, surprised him too.


this is not just source code, it is much better to be called magic.

also love the story behind it.


Here’s a paper that explains how to derive that magic constant and others depending on what measure of error to minimize in the sqrt approximation.

http://www.lomont.org/Math/Papers/2003/InvSqrt.pdf


a tangential question is whether ID software actually had any right to license Q3A under GPL if they had not authored this piece of code


10/10




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: