Meta.Numerics Library

## ComplexMathSqr Method |

Computes the square of a complex number.

Syntax

Remarks

Unlike Sqr(Double), there is slightly more to this method than shorthand for z * z.
In terms of real and imaginary parts z = x + i y, the product z * z = (x * x - y * y) + i(x * y + x * y),
which not only requires 6 flops to evaluate, but also computes the real part as an expression that can easily overflow
or suffer from significant cancelation error. By instead computing z^{2} via as (x - y) * (x + y) + i 2 * x * y,
this method not only requires fewer flops but is also less subject to overflow and cancelation error. You should
therefore generally favor the computation of z^{2} using this method over its computation as z * z.

See Also