News for hackers. Stuff that matters.
Re:Understanding the math behind 0x5f3759df and the fast inv... by lvoudour on Wednesday August 16, 2017 @02:59PM (#15030143)
I first saw the code in the early 2000's and although I figured out the newton-rapshon part I couldn't wrap my head around the magic number, until I read chris Lomont's famous paper[1]. A little gem which reminds us that not that long ago computing resources were a limited commodity.

Abundance is great and speeds up development time, but unfortunately it leads to laziness and bloat

[1] http://www.lomont.org/Math/Papers/2003/InvSqrt.pdf

Re:Understanding the math behind 0x5f3759df and the fast inv... by Sinergy2 on Thursday August 17, 2017 @12:47PM (#15038406)
>> not that long ago computing resources were a limited commodity.

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.

Re:Understanding the math behind 0x5f3759df and the fast inv... by gilbetron on Wednesday August 16, 2017 @11:05PM (#15033493)
Oh man, lets hope Chris doesn't read this - he doesn't need an even bigger ego!

(he's a personal friend and a great guy!)

Re:Understanding the math behind 0x5f3759df and the fast inv... by lvoudour on Thursday August 17, 2017 @04:55AM (#15034938)
Then don't tell him I've also read all his floating point papers as well back in the day :)