5 ms·
Understanding Quake’s Fast Inverse Square Root
- J3L2404 16y agoPot meet kettle. ;) http://news.ycombinator.com/item?id=419166 http://news.ycombinator.com/item?id=419166 Or is this something intentional?
- RiderOfGiraffes 16y agoHah! 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.
- J3L2404 16y agoYour welcome. Will do.
- Natsu 16y agoHow 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 http://graphics.stanford.edu/~seander/bithacks.html
- DanielRibeiro 16y agoNot 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 16y agoGood 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 16y agoMaybe it'd still be seen as a dupe, but you could try http://graphics.stanford.edu/~seander/bithacks.html?dupe=1 http://graphics.stanford.edu/~seander/bithacks.html?dupe=1
- dkersten 16y agoI 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/ http://www.beyond3d.com/content/articles/8/ and part 2: http://www.beyond3d.com/content/articles/15/ http://www.beyond3d.com/content/articles/15/
- J3L2404 16y agoUnfortunately 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?
- ajl2011 16y agohttp://en.wikipedia.org/wiki/Fast_inverse_square_root http://en.wikipedia.org/wiki/Fast_inverse_square_root
- Natsu 16y agoI 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_square_root https://secure.wikimedia.org/wikipedia/en/wiki/Fast_inverse_...
- harshpotatoes 16y agoAnd of course, they skip over the only part I don't understand about that hack. The real meat and potatoes, the magic number.
- dkersten 16y agoHeh, 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)
- deleted 16y ago[deleted]
- narkee 16y agoI 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 16y agoIn 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.