csqrt(), csqrtf(), csqrtl()

Compute the square root of a complex number

Synopsis:

#include <complex.h>

double complex csqrt( double complex z );

float complex csqrtf( float complex z );

long double complex csqrtl( long double complex z );

Arguments:

z
The complex value that you want to get the square root of.

Library:

libm

Use the -l m option to qcc to link against this library.

Description:

These functions compute the square root of the complex number specified by z, with a branch cut along the negative real axis.

To check for error situations, use feclearexcept() and fetestexcept():

Returns:

The square root of z.

If z is: These functions return:
±0+0i +0+0i
x+i ++i, even if x is NaN
x+NaNi NaN+NaNi (unless x is ±) and FE_INVALID may be raised
-+yi +0+i for finite positive y
++yi ++0i for finite positive y
-+NaNi NaN± (sign of imaginary part unspecified)
++NaNi ++NaNi
NaN+yi NaN+NaNi and FE_INVALID may be raised
NaN+NaNi NaN+NaNi

Classification:

ANSI, POSIX 1003.1

Safety:  
Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes