News for hackers. Stuff that matters.
Re:Ask HN: What piece of code/codebase blew your mind when y... by fegu on Monday October 31, 2022 @06:09PM (#33413991)
The doom square root trick. Reducing an expensive function to almost nothing with low error. Many writeups on the web far better than I could give.
Re:Ask HN: What piece of code/codebase blew your mind when y... by jesse__ on Monday October 31, 2022 @06:18PM (#33414093)
I think you mean quakes fast inverse square root? Not aware doom had a clever sqrt routine, but I would be happy to be wrong!
Re:Ask HN: What piece of code/codebase blew your mind when y... by intelVISA on Monday October 31, 2022 @07:10PM (#33414648)
obligatory //what the fuck?
Re:Ask HN: What piece of code/codebase blew your mind when y... by pjscott on Monday October 31, 2022 @08:24PM (#33415330)
You’re right. Doom used fixed-point math; at the time, hardware floating-point units were far from ubiquitous on the computers people wanted to use to play it.
Re:Ask HN: What piece of code/codebase blew your mind when y... by kabr on Monday October 31, 2022 @06:43PM (#33414356)
*Quake
Re:Ask HN: What piece of code/codebase blew your mind when y... by hinkley on Tuesday November 01, 2022 @12:21AM (#33416868)
Doom redefining a circle to be 256 degrees, so that the angle calculations fit into one byte.