hackertube.io

Fast Inverse Square Root — A Quake III Algorithm

Nemean · explainer · Watch on YouTube

What it is

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 Hacker News recommends it

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

  • 3 people recommended it
  • 3 different months
  • 1 strong recommendations
  • first 2021, last 2022

What HN commenters said

  1. “Here's the very fun video if anyone wants to take a look”

    More interesting video about the famous Quake code

    greyfox, 2021-07 · Strong recommendation · in “Copilot regurgitating Quake code, including sweary comments”

  2. “Once that coincidence(?) was explained, Q_rsqrt finally made sense.”

    Explains float bits as logarithm, making Q_rsqrt make sense

    colejohnson66, 2021-08 · Recommendation · in “One does not simply calculate the absolute value”

  3. “This video is approachable and explains it pretty well”

    Approachable explanation of why fast inverse square root works

    infogulch, 2021-09 · Recommendation · in “Bit Patterns of Float”

Excerpts from Hacker News comments, linked to the originals. Summaries and labels were written by a language model from those comments.

Topics: quake iii, ieee 754, floating point, newton's method, bit hacks

Also recommended by the same people