I.2

Computing the Inverse Square Root

Turkowski Ken,     Apple Computer, Inc. Cupertino, California. E-mail address: turk@apple.com

Introduction

In computer graphics calculations, the square root is often followed by a division, as when normalizing vectors:

image

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 a reciprocation. This gem derives the method and provides an implementation for directly computing the inverse square root, f (x) = x−1/2.

Description of the Algorithm

The algorithm is noteworthy, as no divisions ...

Get Graphics Gems V (IBM Version) now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.