HackerTube
HomeLongsLikedHistoryWatch laterCategoriesPlaylistsSettings

Fast Inverse Square Root — A Quake III Algorithm

Nemean3 HN recommenders · recommended in 3 months, 2021-2022
YouTube
6M views · 5 years ago · explainer · evergreen

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.

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

Algorithms & data structuresSoftware performance & optimizationGame history & retro gaming#quakeiii#ieee754#floatingpoint#newton'smethod#bithacks

4 comments from Hacker News

@bitwidget2022 · in “Ask HN: What's a small example of some of the best code ever written?”

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

CitesView on HN
@infogulch2021 · in “Bit Patterns of Float”

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: ▶ this video

RecommendsView on HN
@colejohnson662021 · in “One does not simply calculate the absolute value”

> 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]: ▶ this video (~20 minutes)

RecommendsView on HN
@greyfox2021 · in “Copilot regurgitating Quake code, including sweary comments”

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: ▶ this video

Strongly recommendsView on HN
Finding the BEST sine function for Nintendo 6426:41

Finding the BEST sine function for Nintendo 64

Kaze Emanuar
418K views • 3 years ago
Stanford Seminar: Beyond Floating Point: Next Generation Computer Arithmetic1:31:28

Stanford Seminar: Beyond Floating Point: Next Generation Computer Arithmetic

Stanford Online
33K views • 9 years ago
Stephan T. Lavavej “Floating-Point <charconv>: Making Your Code 10x Faster With C++17's Final Boss”1:00:17

Stephan T. Lavavej “Floating-Point <charconv>: Making Your Code 10x Faster With C++17's Final Boss”

CppCon
41K views • 7 years ago
The Great Debate @ARITH23: John Gustafson and William Kahan1:34:42

The Great Debate @ARITH23: John Gustafson and William Kahan

dancefan
4K views • 10 years ago
Floating Point Numbers - Computerphile9:16

Floating Point Numbers - Computerphile

Computerphile
2.5M views • 12 years ago
TI DOOM2:48

TI DOOM

TPMFofMFF
199K views • 18 years ago
Superpositions, Sudoku, the Wave Function Collapse algorithm.14:28

Superpositions, Sudoku, the Wave Function Collapse algorithm.

Martin Donald
764K views • 6 years ago
FIXING the ENTIRE SM64 Source Code (INSANE N64 performance)18:20

FIXING the ENTIRE SM64 Source Code (INSANE N64 performance)

Kaze Emanuar
3.2M views • 4 years ago
Hacking at Quantum Speed with Shor's Algorithm | Infinite Series16:36

Hacking at Quantum Speed with Shor's Algorithm | Infinite Series

PBS Infinite Series
238K views • 9 years ago
How We Solved the Worst Minigame in Zelda's History24:32

How We Solved the Worst Minigame in Zelda's History

Linkus7
1.1M views • 6 years ago
The Most Underrated Algorithm26:33

The Most Underrated Algorithm

Veritasium
10.8M views • 4 years ago
GradIEEEnt half decent: The hidden power of imprecise lines55:02

GradIEEEnt half decent: The hidden power of imprecise lines

suckerpinch
391K views • 3 years ago
How Quantum Computers Break Encryption | Shor's Algorithm Explained17:31

How Quantum Computers Break Encryption | Shor's Algorithm Explained

minutephysics
3.4M views • 7 years ago
Quake done Quick - Quake done Quickest14:13

Quake done Quick - Quake done Quickest

Quake done Quick
581K views • 16 years ago
27c3: Console Hacking 2010 (en)44:11

27c3: Console Hacking 2010 (en)

Christiaan008
33K views • 15 years ago
Did Nintendo really forget to Optimize Super Mario 64 ? | MVG13:14

Did Nintendo really forget to Optimize Super Mario 64 ? | MVG

Modern Vintage Gamer
1.3M views • 6 years ago
CppCon 2016: Jason Turner “Rich Code for Tiny Computers: A Simple Commodore 64 Game in C++17”1:19:52

CppCon 2016: Jason Turner “Rich Code for Tiny Computers: A Simple Commodore 64 Game in C++17”

CppCon
264K views • 10 years ago
MarI/O - Machine Learning for Video Games5:58

MarI/O - Machine Learning for Video Games

SethBling
11.5M views • 11 years ago
8088 MPH by Hornet + CRTC + DESiRE (final version)8:33

8088 MPH by Hornet + CRTC + DESiRE (final version)

andrewmjenner
93K views • 11 years ago
How I Fixed a 10 Year Old Guitar Hero Bug Without the Source Code12:09

How I Fixed a 10 Year Old Guitar Hero Bug Without the Source Code

ExileLord
404K views • 9 years ago