]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) |
2 | .\" | |
93015253 | 3 | .\" %%%LICENSE_START(VERBATIM) |
fea681da MK |
4 | .\" Permission is granted to make and distribute verbatim copies of this |
5 | .\" manual provided the copyright notice and this permission notice are | |
6 | .\" preserved on all copies. | |
7 | .\" | |
8 | .\" Permission is granted to copy and distribute modified versions of this | |
9 | .\" manual under the conditions for verbatim copying, provided that the | |
10 | .\" entire resulting derived work is distributed under the terms of a | |
11 | .\" permission notice identical to this one. | |
c13182ef | 12 | .\" |
fea681da MK |
13 | .\" Since the Linux kernel and libraries are constantly changing, this |
14 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
15 | .\" responsibility for errors or omissions, or for damages resulting from | |
16 | .\" the use of the information contained herein. The author(s) may not | |
17 | .\" have taken the same level of care in the production of this manual, | |
18 | .\" which is licensed free of charge, as they might when working | |
19 | .\" professionally. | |
c13182ef | 20 | .\" |
fea681da MK |
21 | .\" Formatted or processed versions of this manual, if unaccompanied by |
22 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 23 | .\" %%%LICENSE_END |
fea681da MK |
24 | .\" |
25 | .\" References consulted: | |
26 | .\" Linux libc source code | |
27 | .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) | |
28 | .\" 386BSD man pages | |
29 | .\" Modified Sat Jul 24 19:42:04 1993 by Rik Faith (faith@cs.unc.edu) | |
30 | .\" Added fabsl, fabsf, aeb, 2001-06-07 | |
31 | .\" | |
50831f9b | 32 | .TH FABS 3 2010-09-20 "" "Linux Programmer's Manual" |
fea681da MK |
33 | .SH NAME |
34 | fabs, fabsf, fabsl \- absolute value of floating-point number | |
35 | .SH SYNOPSIS | |
36 | .nf | |
37 | .B #include <math.h> | |
38 | .sp | |
39 | .BI "double fabs(double " x ); | |
40 | .br | |
41 | .BI "float fabsf(float " x ); | |
42 | .br | |
43 | .BI "long double fabsl(long double " x ); | |
44 | .fi | |
45 | .sp | |
20c58d70 | 46 | Link with \fI\-lm\fP. |
824eec7e MK |
47 | .sp |
48 | .in -4n | |
49 | Feature Test Macro Requirements for glibc (see | |
50 | .BR feature_test_macros (7)): | |
51 | .in | |
52 | .sp | |
53 | .ad l | |
54 | .BR fabsf (), | |
55 | .BR fabsl (): | |
2c3ae4cd | 56 | .RS 4 |
8b0d34e4 MK |
57 | _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE || |
58 | _POSIX_C_SOURCE\ >=\ 200112L; | |
2c3ae4cd MK |
59 | .br |
60 | or | |
824eec7e | 61 | .I cc\ -std=c99 |
2c3ae4cd | 62 | .RE |
824eec7e | 63 | .ad b |
fea681da | 64 | .SH DESCRIPTION |
60a90ecd MK |
65 | The |
66 | .BR fabs () | |
67 | functions return the absolute value of the floating-point | |
022671eb MK |
68 | number |
69 | .IR x . | |
824eec7e MK |
70 | .SH RETURN VALUE |
71 | These functions return the absolute value of | |
72 | .IR x . | |
73 | ||
74 | If | |
75 | .I x | |
76 | is a NaN, a NaN is returned. | |
77 | ||
78 | If | |
79 | .I x | |
80 | is \-0, +0 is returned. | |
81 | ||
82 | If | |
83 | .I x | |
84 | is negative infinity or positive infinity, positive infinity is returned. | |
fea681da | 85 | .SH ERRORS |
824eec7e | 86 | No errors occur. |
47297adb | 87 | .SH CONFORMING TO |
824eec7e MK |
88 | C99, POSIX.1-2001. |
89 | The variant returning | |
90 | .I double | |
91 | also conforms to | |
92 | SVr4, 4.3BSD, C89. | |
47297adb | 93 | .SH SEE ALSO |
fea681da | 94 | .BR abs (3), |
36268806 | 95 | .BR cabs (3), |
f0c34053 | 96 | .BR ceil (3), |
fea681da MK |
97 | .BR floor (3), |
98 | .BR labs (3), | |
99 | .BR rint (3) |