csqrt, csqrtf, csqrtl

Retrieves the square root of a complex number, with a branch cut along the negative real axis.

Syntax

_Dcomplex csqrt(
   _Dcomplex z
);
_Fcomplex csqrt(
   _Fcomplex z
);  // C++ only
_Lcomplex csqrt(
   _Lcomplex z
);  // C++ only
_Fcomplex csqrtf(
   _Fcomplex z
);
_Lcomplex csqrtl(
   _Lcomplex z
);

Parameters

z
A complex number.

Return value

The square root of z. The result is in the right half-plane.

Input SEH exception _matherr exception
± QNaN, IND none _DOMAIN
- INF none _DOMAIN

Remarks

Because C++ allows overloading, you can call overloads of csqrt that take and return _Fcomplex and _Lcomplex values. In a C program, csqrt always takes and returns a _Dcomplex value.

Requirements

Routine C header C++ header
csqrt, csqrtf, csqrtl <complex.h> <ccomplex>

For more compatibility information, see Compatibility.

See also

Alphabetical function reference
catanh, catanhf, catanhl
ctanh, ctanhf, ctanhl
catan, catanf, catanl
csinh, csinhf, csinhl
casinh, casinhf, casinhl
ccosh, ccoshf, ccoshl
cacosh, cacoshf, cacoshl
cacos, cacosf, cacosl
ctan, ctanf, ctanl
csin, csinf, csinl
casin, casinf, casinl
ccos, ccosf, ccosl