News for hackers. Stuff that matters.
Re:Ask HN: What piece of code/codebase blew your mind when y... by jph on Monday October 31, 2022 @06:13PM (#33414036)
The Legendary Fast Inverse Square Root with "Voodoo Black Magic"

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

Re:Ask HN: What piece of code/codebase blew your mind when y... by KIFulgore on Monday October 31, 2022 @06:20PM (#33414119)
That one still kills me. By Carmack's comment, surprised him too.
Re:Ask HN: What piece of code/codebase blew your mind when y... by jesse__ on Monday October 31, 2022 @06:15PM (#33414070)
10/10
Re:Ask HN: What piece of code/codebase blew your mind when y... by dis-sys on Tuesday November 01, 2022 @12:00AM (#33416741)
this is not just source code, it is much better to be called magic.

also love the story behind it.

Re:Ask HN: What piece of code/codebase blew your mind when y... by lscharen on Tuesday November 01, 2022 @07:33AM (#33419796)
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

Re:Ask HN: What piece of code/codebase blew your mind when y... by aliswe on Tuesday November 01, 2022 @12:05PM (#33423140)
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