Good videos, with context.
Fast Inverse Square Root — A Quake III Algorithm

Fast Inverse Square Root — A Quake III Algorithm

Nemean
3 HN recommenders · discussed 2021–2022
Open YouTube ↗

About this video

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 it appears in the archive

HN recommends it as an approachable explanation that makes the famous algorithm finally make sense.

AI-generated summary and labels from the source dataset; verify important details against the video. Source & credits.

From the Hacker News discussion

greyfox · 2021-07 · strong rec

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]

Read original comment ↗
colejohnson66 · 2021-08 · rec

> 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)

Read original comment ↗
infogulch · 2021-09 · rec

Apparently 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: [VIDEO]

Read original comment ↗
bitwidget · 2022-08 · reference

print("Hello World") /s But I've heard good things about the Fast Inverse Square Root Calculation algorithm in the Doom 3 source code. [VIDEO]

Read original comment ↗