sqrt
square root function
You're viewing an older version of this page (#4014). View the current version.
INTERFACE
#include <math.h>
double sqrt ( double x )
long sqrtl ( long double x )
float sqrtf ( float x )
#include <complex.h>
complex sqrt(complex x)
double complex csqrt(double complex x)
float complex csqrtf(float complex x)
long double complex csqrtl(long double complex x)
DESCRIPTION
The sqrt function computes the non-negative square root of x, i.e
sqrt(x)
For complex numbers x, sqrt returns the complex root of x, using the following formula
(1)
where is the argument of x.
SPECIAL VALUES
sqrt ( -0 ) returns -0.
sqrt ( x ) returns a NaN and generates a domain error for x < 0.
STANDARDS
The sqrt function conforms to ISO/IEC 9899:1999(E).
COMPATIBILITY
| DOS | UNIX | Windows | ANSI C | C++ only | |
|---|---|---|---|---|---|
| sqrtl | • | • | |||
| Real sqrt | • | • | • | • | |
| Complex sqrt | • | • | • | ||
| Complex csqrt | • | • |