public static Complex Sqr( Complex z )
Public Shared Function Sqr ( z As Complex ) As Complex
public: static Complex Sqr( Complex z )
static member Sqr : z : Complex -> Complex
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 z2 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 z2 using this method over its computation as z * z.