Important: The information in this document is obsolete and should not be used for new development.
fabs
You can use thefabsfunction to determine the absolute value of a real number.
double_t fabs (double_t x); long double fabsl (long double x);
x- Any floating-point number.
DESCRIPTION
Thefabsfunction returns the absolute value (positive value) of its argument.
This function looks only at the sign bit, not the value, of its argument.
EXCEPTIONS
When x is finite and nonzero, the result of is exact.SPECIAL CASES
Table 10-6 shows the results when the argument to thefabsfunction is a zero, a NaN, or an Infinity.
Special cases for the fabsfunctionOperation Result Exceptions raised +0 None +0 None NaN None[27] + ![]()
None + ![]()
None EXAMPLES
z = fabs(-1.0); /* z = 1 */ z = fabs(245.0); /* z = 245 */
[27] If the NaN is a signaling NaN, the invalid exception is raised.