]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) |
2 | .\" | |
5fbde956 | 3 | .\" SPDX-License-Identifier: Linux-man-pages-copyleft |
fea681da MK |
4 | .\" |
5 | .\" References consulted: | |
6 | .\" Linux libc source code | |
7 | .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) | |
8 | .\" 386BSD man pages | |
9 | .\" Modified Sat Jul 24 19:42:04 1993 by Rik Faith (faith@cs.unc.edu) | |
10 | .\" Added fabsl, fabsf, aeb, 2001-06-07 | |
11 | .\" | |
1ae6b2c7 | 12 | .TH FABS 3 2021-03-22 GNU "Linux Programmer's Manual" |
fea681da MK |
13 | .SH NAME |
14 | fabs, fabsf, fabsl \- absolute value of floating-point number | |
2af19291 AC |
15 | .SH LIBRARY |
16 | Math library | |
8fc3b2cf | 17 | .RI ( libm ", " \-lm ) |
fea681da MK |
18 | .SH SYNOPSIS |
19 | .nf | |
20 | .B #include <math.h> | |
68e4db0a | 21 | .PP |
fea681da | 22 | .BI "double fabs(double " x ); |
fea681da | 23 | .BI "float fabsf(float " x ); |
fea681da MK |
24 | .BI "long double fabsl(long double " x ); |
25 | .fi | |
68e4db0a | 26 | .PP |
d39ad78f | 27 | .RS -4 |
824eec7e MK |
28 | Feature Test Macro Requirements for glibc (see |
29 | .BR feature_test_macros (7)): | |
d39ad78f | 30 | .RE |
68e4db0a | 31 | .PP |
824eec7e MK |
32 | .BR fabsf (), |
33 | .BR fabsl (): | |
9d2adbae | 34 | .nf |
5c10d2c5 | 35 | _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L |
9d2adbae MK |
36 | || /* Since glibc 2.19: */ _DEFAULT_SOURCE |
37 | || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE | |
38 | .fi | |
fea681da | 39 | .SH DESCRIPTION |
0d9df44e | 40 | These functions return the absolute value of the floating-point |
022671eb MK |
41 | number |
42 | .IR x . | |
824eec7e MK |
43 | .SH RETURN VALUE |
44 | These functions return the absolute value of | |
45 | .IR x . | |
847e0d88 | 46 | .PP |
824eec7e MK |
47 | If |
48 | .I x | |
49 | is a NaN, a NaN is returned. | |
847e0d88 | 50 | .PP |
824eec7e MK |
51 | If |
52 | .I x | |
53 | is \-0, +0 is returned. | |
847e0d88 | 54 | .PP |
824eec7e MK |
55 | If |
56 | .I x | |
57 | is negative infinity or positive infinity, positive infinity is returned. | |
fea681da | 58 | .SH ERRORS |
824eec7e | 59 | No errors occur. |
594e3173 | 60 | .SH ATTRIBUTES |
6904b640 MK |
61 | For an explanation of the terms used in this section, see |
62 | .BR attributes (7). | |
c466875e MK |
63 | .ad l |
64 | .nh | |
6904b640 MK |
65 | .TS |
66 | allbox; | |
c466875e | 67 | lbx lb lb |
6904b640 MK |
68 | l l l. |
69 | Interface Attribute Value | |
70 | T{ | |
594e3173 PH |
71 | .BR fabs (), |
72 | .BR fabsf (), | |
594e3173 | 73 | .BR fabsl () |
6904b640 MK |
74 | T} Thread safety MT-Safe |
75 | .TE | |
c466875e MK |
76 | .hy |
77 | .ad | |
78 | .sp 1 | |
47297adb | 79 | .SH CONFORMING TO |
9a74e018 | 80 | C99, POSIX.1-2001, POSIX.1-2008. |
847e0d88 | 81 | .PP |
824eec7e MK |
82 | The variant returning |
83 | .I double | |
84 | also conforms to | |
85 | SVr4, 4.3BSD, C89. | |
47297adb | 86 | .SH SEE ALSO |
fea681da | 87 | .BR abs (3), |
36268806 | 88 | .BR cabs (3), |
f0c34053 | 89 | .BR ceil (3), |
fea681da MK |
90 | .BR floor (3), |
91 | .BR labs (3), | |
92 | .BR rint (3) |