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 <= 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 at‐
50 tributes(7).
51
52 ┌────────────────────────────────────────────┬───────────────┬─────────┐
53 │Interface │ Attribute │ Value │
54 ├────────────────────────────────────────────┼───────────────┼─────────┤
55 │sqrt(), sqrtf(), sqrtl() │ Thread safety │ MT-Safe │
56 └────────────────────────────────────────────┴───────────────┴─────────┘
57
59 C99, POSIX.1-2001, POSIX.1-2008.
60
61 The variant returning double also conforms to SVr4, 4.3BSD, C89.
62
64 cbrt(3), csqrt(3), hypot(3)
65
67 This page is part of release 5.13 of the Linux man-pages project. A
68 description of the project, information about reporting bugs, and the
69 latest version of this page, can be found at
70 https://www.kernel.org/doc/man-pages/.
71
72
73
74 2021-03-22 SQRT(3)