Loading...
Select Version
&pagelevel(4)&pagelevel
Definition | #include <math.h> double fabs(double x); These functions calculate the absolute value of a floating-point number x. |
Return val. | Absolute value of the argument: |
Example | The following program calculates the absolute value of a floating-point number entered: #include <math.h> #include <stdio.h> int main(void) { double x; printf("Please enter a floating-point number:\n"); if (scanf("%lf", &x) == 1) printf("?%g? = %g\n", x, fabs(x)); return 0; } |
See also | abs, cabs, ceil, floor, labs, llabs |