1sqrt(3) Library Functions Manual sqrt(3)
2
3
4
6 sqrt, sqrtf, sqrtl - square root function
7
9 Math library (libm, -lm)
10
12 #include <math.h>
13
14 double sqrt(double x);
15 float sqrtf(float x);
16 long double sqrtl(long double x);
17
18 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
19
20 sqrtf(), sqrtl():
21 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
22 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
23 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
24
26 These functions return the nonnegative square root of x.
27
29 On success, these functions return the square root of x.
30
31 If x is a NaN, a NaN is returned.
32
33 If x is +0 (-0), +0 (-0) is returned.
34
35 If x is positive infinity, positive infinity is returned.
36
37 If x is less than -0, a domain error occurs, and a NaN is returned.
38
40 See math_error(7) for information on how to determine whether an error
41 has occurred when calling these functions.
42
43 The following errors can occur:
44
45 Domain error: x less than -0
46 errno is set to EDOM. An invalid floating-point exception
47 (FE_INVALID) is raised.
48
50 For an explanation of the terms used in this section, see at‐
51 tributes(7).
52
53 ┌────────────────────────────────────────────┬───────────────┬─────────┐
54 │Interface │ Attribute │ Value │
55 ├────────────────────────────────────────────┼───────────────┼─────────┤
56 │sqrt(), sqrtf(), sqrtl() │ Thread safety │ MT-Safe │
57 └────────────────────────────────────────────┴───────────────┴─────────┘
58
60 C11, POSIX.1-2008.
61
63 C99, POSIX.1-2001.
64
65 The variant returning double also conforms to SVr4, 4.3BSD, C89.
66
68 cbrt(3), csqrt(3), hypot(3)
69
70
71
72Linux man-pages 6.05 2023-07-20 sqrt(3)