

Understanding Quake’s Fast Inverse Square Root - RiderOfGiraffes
http://betterexplained.com/articles/understanding-quakes-fast-inverse-square-root

======
dkersten
I remember when this came up on gamedev.net many years ago and Chris Lomont
(who, at least at the time - don't know about now, was a regular on the
gamedev.net forums) came up with his paper explaining why this works (and
coming up with a better constant). Brings me back :-P

Of course, this site is so much easier to understand than Chris' paper.

The history of this function (posted on Beyond3D[1]) is facinating too.

[1] Part 1: <http://www.beyond3d.com/content/articles/8/> and part 2:
<http://www.beyond3d.com/content/articles/15/>

~~~
omaranto
The reason this site is easier to understand than the quoted paper is, of
course, that it explains everything but the interesting part which is the
subject of the paper.

~~~
dkersten
True. I would love an idiot-explanation of that, so that I can understand it
too.

------
harshpotatoes
And of course, they skip over the only part I don't understand about that
hack. The real meat and potatoes, the magic number.

~~~
dkersten
Heh, yeah. I believe Chris Lomonts paper talks about how it was derived (at
least, he derives a new one, so I guess he must have figured it out - it went
over my head though)

------
narkee
I always thought "inverse" square root was a misnomer. The actual inverse of
the square root is the square.

This should either be called multiplicative inverse square root, or reciprocal
square root, no?

~~~
dkersten
In the case of the SSE instruction set, it is call reciprocal square root. I
guess, when people say inverse, they often actually mean multiplicative
inverse.

------
J3L2404
Pot meet kettle. ;)

<http://news.ycombinator.com/item?id=419166>

Or is this something intentional?

~~~
RiderOfGiraffes
Hah! I'm glad you replied so I can say thanks for your kind comment earlier.

Thank you.

And this is indeed something intentional. I continue to explore the community,
as well as trying to provide value. I don't duplicate things unless I think
there is genuine value, and this is (a) very old, (b) really cool, and (c)
genuinely hacking.

Thanks for noticing. More details if you email me, but I've got a large
backlog at the moment so won't reply immediately.

~~~
Natsu
How long is it before you can dupe something? A while back, I tried to submit
a cool little list of bit hacks, only to find out that the exact same thing
had been submitted years ago.

I guess many people probably know about it, but it's a pretty nice list of low
level bit hacks:

<http://graphics.stanford.edu/~seander/bithacks.html>

~~~
DanielRibeiro
Not a dupe:

The other thread's url: betterexplained.com/articles/understanding-quakes-
fast-inverse-square-root/

This's url: betterexplained.com/articles/understanding-quakes-fast-inverse-
square-root

One character as difference: the final slash.

~~~
Natsu
Good catch!

I guess no one can submit that list of bit hacks ever again, unless the dupe-
catcher is changed or someone figures out a way to access it from an alternate
URL (the site says we're not free to mirror it, even if we're free to use the
hacks).

~~~
AlecSchueler
Maybe it'd still be seen as a dupe, but you could try
<http://graphics.stanford.edu/~seander/bithacks.html?dupe=1>

------
J3L2404
Unfortunately the magic number is still magic, even though I read the paper
linked at the bottom. Can anyone summarize the reason that number works well?

~~~
Natsu
I don't know how many people have showdead on, so I'll repeat the link from
the dead comment for those who use the default setting, because it has a good
answer:

[https://secure.wikimedia.org/wikipedia/en/wiki/Fast_inverse_...](https://secure.wikimedia.org/wikipedia/en/wiki/Fast_inverse_square_root)

