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