Understanding the math behind 0x5f3759df and the fast inverse square root (2012)
h14s.p5r.org
h14s.p5r.org
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.
Abundance is great and speeds up development time, but unfortunately it leads to laziness and bloat
They are still limited in non-phone embedded contexts these days, leading to the ironic situation that the radar in your car that can override your brakes is running a much weaker CPU than your phone. RAM measured in the low megabytes.
Source: I write code for one of those radars and this constant appears in that code, alongside several other sqrt implementations of varying resolutions (8b, 16b, float). You are expected to use the least-resolution option in your algorithm, based on your analysis/testing. Same goes for trig functions.
I have to keep computer game development textbooks from the nineties and aughts around for reference material.
(he's a personal friend and a great guy!)
That depends on the math you use. In this case you are given a floating point argument, so there really isn't a concept of reciprocal either, because it's not a rational number. There are places where "reciprocal" is not specific to the rationals, but there it is usually a more general term meaning pretty much the same as inverse.
In both cases context is everything, and trying to read this - as with all math - in isolation is likely, almost inevitable, to cause confusion.
In this case it's the multiplicative inverse of the square root of the argument.
I understand why you've changed the title, but I believe that in this case in doing so you have reduced its usefulness. Since you've not even changed it to the title of the actual article, it's clear that you have given this some thought. Having spent that time, I think your decision is wrong, and don't understand the reasoning behind this change.
To other readers, the title I originally gave was:
Understanding the math behind
the magic const 0x5f3759df and
the fast inverse sqrt.
Please note: This isn't a complaint - I'm providing this here so the information the original title I gave isn't lost.(Although I fully appreciate that this comment will most likely end up off the top page of comments, and hence never be seen. <fx: shrug />
There are many articles about this hack, but many just write about it and it’s history but don’t actually derive the constant. This article demystifies it by showing that it’s just simple math.