CSQRT(3) | Library Functions Manual | CSQRT(3)

# NAME

`csqrt`, `csqrtf`, `csqrtl` — complex square root

# SYNOPSIS

Math Library (libm, -lm)
`#include <complex.h>`

double complex
`csqrt`(double complex z);

float complex
`csqrtf`(float complex z);

long double complex
`csqrtl`(long double complex z);

# DESCRIPTION

The `csqrt`(), `csqrtf`() and `csqrtl`() functions compute the complex square root of z.

If z = x + iy, then

    Re csqrt(z) = [ (|z| + x) / 2 ]^(1/2).
    Im csqrt(z) = [ (|z| - x) / 2 ]^(1/2).

Note that -csqrt(z) is also a square root of z. The root chosen is always in the right half plane and Im csqrt(z) has the same sign as y.

# RETURN VALUES

The `csqrt`(), `csqrtf`() and `csqrtl`() functions return the complex square root of z.

# SEE ALSO

cpow(3)

# STANDARDS

The `csqrt`(), `csqrtf`() and `csqrtl`() functions conform to ISO/IEC 9899:1999 (“ISO C99”).

June 7, 2025 | Debian