#include <math.h> double fabs(double y);
fabs
takes the absolute value of a double-precision, floating-point number.
fabs
returns the absolute value of the argument y
. Both the
operand y
and the result are of type double
.
fabs
is implemented as a built-in function unless it is undefined by an
#undef
statement.
#include <math.h> #include <stdio.h> main() { double a, b, c; puts("Enter values for a & b"); scanf("%lf %lf", &a, &b); c = fabs(a-b); printf("The absolute value of their difference = %f", c ); }
abs
, labs
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.