Need the Inverse Square Root of a Number, Fast?

by Marshall on December 1, 2006

Quake 3 has a the following bit of code to calculate the inverse square of an integer.

InvSqrt()

The i = 0x5f3759df - (i >> 1); is the most curious part of the function, and apparently is has to do with Newton’s Method, which is an efficient way to approximate the roots of a function.

( via Slashdot )

Leave your comment

Required.

Required. Not published.

If you have one.