Section: Linux Programmer's Manual (3)
Return to Main Contents
sqrt, sqrtf, sqrtl - square root function
double sqrt(double x);
float sqrtf(float x);
long double sqrtl(long double x);
Link with -lm.
Feature Test Macro Requirements for glibc (see
_BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE ||
_POSIX_C_SOURCE >= 200112L;
function returns the nonnegative square root of
On success, these functions return the square root of
is a NaN, a NaN is returned.
is +0 (-0), +0 (-0) is returned.
is positive infinity, positive infinity is returned.
is less than -0,
a domain error occurs,
and a NaN is returned.
for information on how to determine whether an error has occurred
when calling these functions.
The following errors can occur:
- Domain error: x less than -0
is set to
An invalid floating-point exception
The variant returning
also conforms to
SVr4, 4.3BSD, C89.
This page is part of release 3.54 of the Linux
A description of the project,
and information about reporting bugs,
can be found at
- RETURN VALUE
- CONFORMING TO
- SEE ALSO
This document was created by
using the manual pages.
Time: 10:12:00 GMT, January 18, 2018