Square root any nonnegative number, then the principal square root of −"x" is The right side (as well as its negative) is indeed a square root of −"x", since For every non-zero complex number "z" there exist precisely two numbers "w" such that : the principal square root of "z" (defined below), and its negative. There are two complex numbers that square to a given arbitrary non-zero imaginary number formula_11 with real formula_12 where the two-digit pattern {3, 6} repeats over and over again in the partial denominators. Since , the above is also identical to the following generalized continued fractions: The
Fast inverse square root The calculation of is based on the identity Using the approximation of the logarithm above, applied to both and , the above equation gives: Thus, an approximation of is: which is written in the code as The first term above is the magic number from which it can be inferred that . The second term, , is calculated by shifting the bits of one position to the right. With as the inverse square root, . The approximation yielded by the earlier steps can be refined by using a root-finding method, a method that finds the zero of a function. The