Computing the Inverse Square Root

Publisher Summary This chapter presents an algorithm for computing the inverse square root. In computer graphics calculations, the square root is often followed by a division, as when normalizing vectors. This adds a significant amount of computational overhead, as a floating-point division typically costs much more than multiplication. The cost of division may be mitigated by reciprocation. This chapter derives the method and provides an implementation for directly computing the inverse square root, f(x) = x−½. The algorithm is noteworthy, as no divisions are required. It is based upon the method of successive approximations. The square root may also be computed at the cost of one additional multiplication. The algorithm has two parts—computing an initial estimate, and refining the root by using a fixed number of iterations. The procedure has been exhaustively tested for all single-precision IEEE mantissas lying between 0.5 and 2.0 using IEEE arithmetic.