orld.wolfram.com/SquareRoot.html" TARGET="_top"> square root of this complex number. Implements the following algorithm to compute {@code sqrt(a + bi)}:
- Let {@code t = sqrt((|a| + |a + bi|) / 2)}
if {@code a ≥ 0} return {@code t + (b/2t)i}else return {@code |b|/2t + sign(b)t i }
where
- {@code |a| = }{@link FastMath#abs}(a)
- {@code |a + bi| = }{@link Complex#abs}(a + bi)
- {@code sign(b) = }{@link FastMath#copySign(double,double) copySign(1d, b)}
Returns {@link Complex#NaN} if either real or imaginary part of theinput argument is {@code 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
@return the square root of {@code this}.
@since 1.2