Top all-time · #3822
Christian Plesner Hansen
Personal blog · h14s.p5r.org · on HN as plesnerprogrammingsystems
Christian Plesner Hansen writes Hummus and Magnets, a personal blog at h14s.p5r.org about programming and systems. Since 2014, 20 different Hacker News readers have linked it 26 times, most often “Understanding the math behind 0x5f3759df and the fast inverse square root (2012)”. It is still writing: the last post was on 2024-12-06, and you can follow it by feed.
Too few sampled comments (6) to say how often HN recommends it.?
Why HN links it
HN readers link this blog for its explanation of the math behind the fast inverse square root (0x5f3759df). Commenters cite it as a clear, intuitive treatment, and its appendix is singled out.
Summarised by Claude from a sample of 6 HN comments that link here. Each comment is marked recommending, critical or neutral (citing without judging); how this works.
I’m Christian Plesner Hansen. I’m a software engineer working out of Århus, Denmark. This is my technical blog.
Most-linked posts?
- Understanding the math behind 0x5f3759df and the fast inverse square root (2012)11 people · 12 mentions · first linked 2014-10-28
- 0x5f3759df2 people · 2 mentions · first linked 2025-08-24
- 0x5f3759df2 people · 2 mentions · first linked 2017-08-15
What Hacker News says?
Here's the best explanation I've seen: http://h14s.p5r.org/2012/09/0x5f3759df.html
Comment linking /2012/09/0x5f3759df.html
on “BetterExplained: Math Lessons That Explain Concepts”Submitted Understanding the math behind 0x5f3759df and the fast inverse square root (2012) as a story · 222 points
HN discussionBabbage's notes describe what we would call branch-if-zero and branch-if-negative instructions which you could use to implement repetition. Control flow was the least well developed part of the instruction set though, presumably because it would be trivial to implement compared to the arithmetic operations so it could wait. If you're interested in that kind of thing I wrote a description of the entire instruction se…
Comment linking /2012/11/punched-cards.html
on “What Did Ada Lovelace’s Program Actually Do?”Submitted Why I find IEEE 754 frustrating as a story · 140 points
HN discussion> L1. There are gaps out there. I had a similar experience. At one point I decided that I wanted to understand, step by step, how Ada Lovelace's Bernoulli program works[1]. There was a few steps that didn't seem right to me but I was sure if there were any bugs in there they would be well-known and mentioned somewhere I could find. This being one of the most iconic and historically significant programs ever written.…
Comment linking /2012/12/bernoulli.html
on “Surprises of the Faraday Cage”Submitted 0x5f3759df and the fast inverse square root (2012) as a story · 125 points
HN discussionHere's another article (from 2012) describing the same calculation: http://h14s.p5r.org/2012/09/0x5f3759df.html
Comment linking /2012/09/0x5f3759df.html
on “Fast Inverse Square Root”Submitted Fast inverse square-root hack with magic constant 0x5f3759df (2012) as a story · 46 points
HN discussionCarmack also started a rocket company at a time when it was much more difficult to do so (there were far fewer government dollars available via contracts), Bezos also has far more capital to put in than Carmack. Not undeservingly Carmack is something of a folk hero here (for example: http://h14s.p5r.org/2012/09/0x5f3759df.html ) but I don't think being a 10X programmer necessarily translates into great rocket compan…
Comment linking /2012/09/0x5f3759df.html
on “Jeff Bezos Lifts Veil on His Rocket Company, Blue Origin”Submitted The magic of the fast inverse square root (2012) as a story · 41 points
HN discussionBe sure to read the appendix, which is an easy-to-miss link at the end: http://h14s.p5r.org/2012/09/0x5f3759df-appendix.html The appendix was by far the most interesting part to me, after reading it I felt like I really got the intuition behind how the trick works.
Comment linking /2012/09/0x5f3759df-appendix.html
on “Understanding the math behind 0x5f3759df and the fast inverse square root (2012)”Submitted 0x5f3759df as a story · 29 points
HN discussionWhat's the algorithm for mapping between locations and names? If I wanted to integrate this into my own code how would I do that -- is there a library? Coincidentally I published a post about almost exactly the same thing only a few hours ago, http://h14s.p5r.org/2014/09/z-quads-strings.html . But it focuses more on the algorithmic side which is why I'm curious about the mechanics of UBIs.
Comment linking /2014/09/z-quads-strings.html
on “Show HN: Give 7 billion people a physical address”Submitted Shift/Reduce Expression Parsing as a story · 21 points
HN discussion1/sqrt(x) is complicated. Imagine instead of computing 1/sqrt(x), imagine instead that you wanted to compute exp_2(-.5 log_2(x)). Also imagine you have an ultra fast way to compute exp_2 and log_2. If you have an ultra fast way to compute exp_2 and log_2, then exp_2(-.5 log_2(x)) is gonna be fast to compute. It turns out you do have an ultra fast way to compute log_2: you bitcast a float to an integer, and then twid…
Comment linking /2012/09/0x5f3759df.html
on “A simple way to generate random points on a sphere”Submitted 0x5f3759df as a story · 6 points
HN discussionThanks for sharing that. I've actually been learning some Forth recently and had been wondering how a parser or a compiler might actually look using Forth, and you actually already made one, which is pretty cool. I was wondering this because deterministic parsers are often already stack based (LL and LR parsers can both be implemented as imperative programs that manipulate a stack based on the input tokens, or just…
Comment linking /2014/10/shiftreduce-expression-parsing-by-douglas-gregor.html
on “OBNC – Oberon-07 Compiler”Submitted Fast inverse square root, with a mystery constant (2012) as a story · 5 points
HN discussionHere it is: http://h14s.p5r.org/2014/09/z-quads-conversions.html
Comment linking /2014/09/z-quads-conversions.html
on “Z-Quads, a spatial coordinate system”Submitted 0x5f3759df as a story · 4 points
HN discussionSubmitted Bitwise Division as a story · 4 points
HN discussionSubmitted Quake 3's Fast Inverse Square Root as a story · 4 points
HN discussionSubmitted 0x5f3759df: 1/sqrt(x) as a story · 3 points
HN discussionSubmitted Bigger Better Varints as a story · 2 points
HN discussionSubmitted Why 0x5f3759df? (2012) as a story · 2 points
HN discussionSubmitted Fast inverse square root and the constant 0x5f3759df (2012) as a story · 1 points
HN discussion