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