![]() Chapter Contents |
![]() Previous |
![]() Next |
| fabs |
| Portability: | ISO/ANSI C conforming, UNIX compatible |
| SYNOPSIS | |
| DESCRIPTION | |
| RETURN VALUE | |
| IMPLEMENTATION | |
| EXAMPLE | |
| RELATED FUNCTIONS | |
| SEE ALSO |
| SYNOPSIS |
#include <math.h> double fabs(double y);
| DESCRIPTION |
fabs
takes the absolute value of a double-precision, floating-point number.
| RETURN VALUE |
fabs
returns the absolute value of the argument
y
.
Both the operand
y
and the result are
of type
double
.
| IMPLEMENTATION |
fabs
is implemented as a built-in function unless it is undefined by an
#undef
statement.
| EXAMPLE |
#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 );
}
| RELATED FUNCTIONS |
| SEE ALSO |
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.