std::sqrt(std::complex)
From cppreference.com
Defined in header <complex>
|
||
template< class T > std::complex<T> sqrt( const std::complex<T>& z ); |
||
Computes the square root of the complex number z with a branch cut along the negative real axis.
Contents |
[edit] Parameters
z | - | complex number to take the square root of |
[edit] Return value
If no errors occur, returns the square root of z, in the range of the right half-plane, including the imaginary axis ([0; +∞) along the real axis and (−∞; +∞) along the imaginary axis).
[edit] Error handling and special values
Errors are reported consistent with math_errhandling.
If the implementation supports IEEE floating-point arithmetic,
- The function is continuous onto the branch cut taking into account the sign of imaginary part
- std::sqrt(std::conj(z)) == std::conj(std::sqrt(z))
- If z is
(±0,+0)
, the result is(+0,+0)
- If z is
(x,+∞)
, the result is(+∞,+∞)
even if x is NaN - If z is
(x,NaN)
, the result is(NaN,NaN)
(unless x is ±∞) and FE_INVALID may be raised - If z is
(-∞,y)
, the result is(+0,+∞)
for finite positive y - If z is
(+∞,y)
, the result is(+∞,+0)
for finite positive y - If z is
(-∞,NaN)
, the result is(NaN,∞)
(sign of imaginary part unspecified) - If z is
(+∞,NaN)
, the result is(+∞,NaN)
- If z is
(NaN,y)
, the result is(NaN,NaN)
and FE_INVALID may be raised - If z is
(NaN,NaN)
, the result is(NaN,NaN)
[edit] Notes
The semantics of this function are intended to be consistent with the C function csqrt.