Double-precision floating point (±1.7E±308, ~15 decimal digits)
1st Parameter
The input value for which the absolute value is computed
Read more about parameters of fabs in parameters section
The fabsfunction in C language Calculates the absolute value of a floating-point number.
The fabs function computes the absolute value of a floating-point number x. It returns |x|, which is x if x is non-negative, and -x if x is negative. This function is useful in many mathematical calculations where the magnitude of a number is needed regardless of its sign.
The fabsfunction takes 1
parameter:
•
double `x`: The input value for which the absolute value is computed
Computes the absolute value of the given floating-point number `x`, returning the result as a `double`. If the input is negative, the result is its positive counterpart.
The fabs function return value :
Returns the absolute value of x as a double
Output
This example demonstrates the basic usage of the `fabs` function for various input values, including positive, negative, and zero values.