C Language: fabs function
(Absolute Value of Floating-Point Number)
In the C Programming Language, the fabs function returns the absolute value of a floating-point number.
Syntax
The syntax for the fabs function in the C Language is:
Parameters or Arguments
Returns
The fabs function returns the absolute value of a floating-point number represented by x.
Required Header
In the C Language, the required header for the fabs function is:
Applies To
In the C Language, the fabs function can be used in the following versions:
fabs, fabsf, fabsl, fabsd32, fabsd64, fabsd128
The functions with decimal floating point parameters are declared if and only the implementation predefines __STDC_IEC_60559_DFP__ (i.e. the implementation supports decimal floating point numbers).
Contents
[edit] Parameters
arg | — | floating point value |
arith | — | floating point or integer value |
[edit] Return value
If successful, returns the absolute value of arg ( \(\small |arg| \) |arg| ). The value returned is exact and does not depend on any rounding modes.
[edit] Error handling
This function is not subject to any of the error conditions specified in math_errhandling.
If the implementation supports IEEE floating-point arithmetic (IEC 60559),