1SQRT(3) Linux Programmer's Manual SQRT(3)
2
3
4
6 sqrt, sqrtf, sqrtl - square root function
7
9 #include <math.h>
10
11 double sqrt(double x);
12 float sqrtf(float x);
13 long double sqrtl(long double x);
14
15 Link with -lm.
16
17 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
18
19 sqrtf(), sqrtl():
20 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600 ||
21 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L;
22 or cc -std=c99
23
25 The sqrt() function returns the nonnegative square root of x.
26
28 On success, these functions return the square root of x.
29
30 If x is a NaN, a NaN is returned.
31
32 If x is +0 (-0), +0 (-0) is returned.
33
34 If x is positive infinity, positive infinity is returned.
35
36 If x is less than -0, a domain error occurs, and a NaN is returned.
37
39 See math_error(7) for information on how to determine whether an error
40 has occurred when calling these functions.
41
42 The following errors can occur:
43
44 Domain error: x less than -0
45 errno is set to EDOM. An invalid floating-point exception
46 (FE_INVALID) is raised.
47
49 C99, POSIX.1-2001. The variant returning double also conforms to SVr4,
50 4.3BSD, C89.
51
53 cbrt(3), csqrt(3), hypot(3)
54
56 This page is part of release 3.53 of the Linux man-pages project. A
57 description of the project, and information about reporting bugs, can
58 be found at http://www.kernel.org/doc/man-pages/.
59
60
61
62 2010-09-20 SQRT(3)