Syntax
#include <math.h> double fabs(double x);Description
fabs calculates the absolute value of the floating-point argument x.
fabs returns the absolute value. There is no error return value.
This example calculates y as the absolute value of x:
#include <math.h>
int main(void)
{
double x,y;
x = -5.6798;
y = fabs(x);
printf("fabs( %lf ) = %lf\n", x, y);
return 0;
/****************************************************************************
The output should be similar to :
fabs( -5.679800 ) = 5.679800
****************************************************************************/
}
Related Information