sqrt abstract method
Compute the square root of this complex number.
Implements the following algorithm to compute `sqrt(a + bi)}:
- Let
t = sqrt((|a| + |a + bi|) / 2)
- if
a ≥ 0
returnt + (b/2t)i
else return|b|/2t + sign(b)t i
where:
|a| = abs(a)
|a + bi| = abs(a + bi)
sign(b) = copySign(double, double) copySign(1d, b)
Returns nan if either real or imaginary part of the
input argument is NaN
.
Infinite values in real or imaginary parts of the input may result in infinite or NaN values returned in parts of the result.
Examples:
sqrt(1 ± INFINITY i) = INFINITY + NaN i
sqrt(INFINITY + i) = INFINITY + 0i
sqrt(-INFINITY + i) = 0 + INFINITY i
sqrt(INFINITY ± INFINITY i) = INFINITY + NaN i
sqrt(-INFINITY ± INFINITY i) = NaN ± INFINITY i
Implementation
Complex sqrt();