1fabs(3) Library Functions Manual fabs(3)
2
3
4
6 fabs, fabsf, fabsl - absolute value of floating-point number
7
9 Math library (libm, -lm)
10
12 #include <math.h>
13
14 double fabs(double x);
15 float fabsf(float x);
16 long double fabsl(long double x);
17
18 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
19
20 fabsf(), fabsl():
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 absolute value of the floating-point number
27 x.
28
30 These functions return the absolute value of x.
31
32 If x is a NaN, a NaN is returned.
33
34 If x is -0, +0 is returned.
35
36 If x is negative infinity or positive infinity, positive infinity is
37 returned.
38
40 No errors occur.
41
43 For an explanation of the terms used in this section, see at‐
44 tributes(7).
45
46 ┌────────────────────────────────────────────┬───────────────┬─────────┐
47 │Interface │ Attribute │ Value │
48 ├────────────────────────────────────────────┼───────────────┼─────────┤
49 │fabs(), fabsf(), fabsl() │ Thread safety │ MT-Safe │
50 └────────────────────────────────────────────┴───────────────┴─────────┘
51
53 C11, POSIX.1-2008.
54
56 C99, POSIX.1-2001.
57
58 The variant returning double also conforms to SVr4, 4.3BSD, C89.
59
61 abs(3), cabs(3), ceil(3), floor(3), labs(3), rint(3)
62
63
64
65Linux man-pages 6.04 2023-03-30 fabs(3)