4 comments

[ 2.5 ms ] story [ 36.9 ms ] thread
I tried implementing it in JS just for fun. I don't get how/why it works, but it does.

http://codepen.io/anon/pen/OWgYaP

Is your implementation correct? I get strange values.

    Q_rsqrt(16) = 0.24957678739619552
I'm not sure if I'm just not doing something correctly. Even if I go to a smaller number I get:

    Q_rsqrt(0.125) = 2.828426859705843
Which is vastly off (10x ish)
More accurate numbers are

  0.25
and

  2.8284271247461900976033774484194
respectively.