THE VIDEO SHELF · fast inverse square root
Fast Inverse Square Root — A Quake III Algorithm
A walkthrough of the Quake III fast inverse square root, explaining where the constant 0x5f3759df comes from. It covers IEEE 754 floats, the bit hack that approximates a logarithm, and a Newton's method refinement.
Why HN readers recommended it
HN recommends it as an approachable explanation that makes the famous algorithm finally make sense.
This is a summary from the source dataset, not an endorsement by Hacker News or the video creator.
Video & recommendation details
- Creator / channel
- Nemean
- Topic
- fast inverse square root
- Format
- explainer
- Level
- intermediate
- HN recommenders in dataset
- 3
- HN mentions in dataset
- 4
- Recommendation years in dataset
- 2021–2022
These counts and years describe the included Hacker News records; they are not YouTube views or the video’s publication date.
From the original HN conversations
Excerpts from the recorded comments. Follow each source for the full comment and surrounding discussion.
Very interesting that this was posted as I literally JUST watched an even MORE interesting youtube upload about this very bit of code just last weekend. Here's the very fun video if anyone wants to take a look: [VIDEO]
greyfox on Hacker News · 2021-07
In Copilot regurgitating Quake code, including sweary comments> The bits of a float as an integer literal are proportional to its log2 value (plus a constant), … I watched a video[0] a while back about that. Once that coincidence(?) was explained, Q_rsqrt finally made sense. [0]: [VIDEO] (~20 minutes)
colejohnson66 on Hacker News · 2021-08
In One does not simply calculate the absolute valueApparently the bit pattern of a float interpreted as an int is sorta-kinda it's own logarithm, which is why the famous fast inverse square root from quake 3 works: log(x^-½) = -½log(x) =~ -log(x) >> 1. This video is approachable and explains it pretty well: …
infogulch on Hacker News · 2021-09
In Bit Patterns of Float
Summaries, classifications and recommendation records are from the HackerTube source dataset. Read about this library and its limitations.