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 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
21 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
22 || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
23
25 These functions return 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 For an explanation of the terms used in this section, see
50 attributes(7).
51
52 ┌─────────────────────────┬───────────────┬─────────┐
53 │Interface │ Attribute │ Value │
54 ├─────────────────────────┼───────────────┼─────────┤
55 │sqrt(), sqrtf(), sqrtl() │ Thread safety │ MT-Safe │
56 └─────────────────────────┴───────────────┴─────────┘
58 C99, POSIX.1-2001, POSIX.1-2008.
59
60 The variant returning double also conforms to SVr4, 4.3BSD, C89.
61
63 cbrt(3), csqrt(3), hypot(3)
64
66 This page is part of release 5.07 of the Linux man-pages project. A
67 description of the project, information about reporting bugs, and the
68 latest version of this page, can be found at
69 https://www.kernel.org/doc/man-pages/.
70
71
72
73 2017-09-15 SQRT(3)