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(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600
20 || _ISOC99_SOURCE; or cc -std=c99
21
23 The sqrt() function returns the non-negative square root of x.
24
26 On success, these functions return the square root of x.
27
28 If x is a NaN, a NaN is returned.
29
30 If x is +0 (-0), +0 (-0) is returned.
31
32 If x is positive infinity, positive infinity is returned.
33
34 If x is less than -0, a domain error occurs, and a NaN is returned.
35
37 See math_error(7) for information on how to determine whether an error
38 has occurred when calling these functions.
39
40 The following errors can occur:
41
42 Domain error: x less than -0
43 errno is set to EDOM. An invalid floating-point exception
44 (FE_INVALID) is raised.
45
47 C99, POSIX.1-2001. The variant returning double also conforms to SVr4,
48 4.3BSD, C89.
49
51 cbrt(3), csqrt(3), hypot(3)
52
54 This page is part of release 3.22 of the Linux man-pages project. A
55 description of the project, and information about reporting bugs, can
56 be found at http://www.kernel.org/doc/man-pages/.
57
58
59
60 2008-08-05 SQRT(3)