- NAME
-
sqrt - square root function.
- SYNOPSIS
#include <math.h>
double sqrt(double x);
- DESCRIPTION
-
The sqrt() function returns the non-negative square root of x. It fails and sets errno to EDOM, if x is negative.
Warning
|
You’ll also need to link the program against the math library (see example below) using the -lm compile/link option.
|
- RETURN VALUE
-
Square root of x.
- ERRORS
-
-
EDOM - x is negative.
-
- SEE ALSO
-
exp, log, log10, pow
- EXAMPLE
link:src/sqrt.c[role=include]
- OUTPUT
$ gcc -Wall -lm sqrt.c $ ./a.out sqrt(1024.000000) = 32.000000