Compute the floating point absolute value.
Compatibility:This function is compatible with the following targets:
|
|
#include <math.h>
double fabs(double x);
float fabsf(float);
long double fabsl(long double);Parameters:
Parameters for this function are:
fabs() returns the absolute value of x.
#include <math.h>
#include <stdio.h>
int main(void)
{
double s = -5.0, t = 5.0;
printf("Absolute value of %f is %f.\n", s, fabs(s));
printf("Absolute value of %f is %f.\n", t, fabs(t));
return 0;
}
Output:
Absolute value of -5.000000 is 5.000000.
Absolute value of 5.000000 is 5.000000.
[ First ] [ Previous ] [ Next ] [ Last ] [ Manuals ]
Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.
Last updated: August 16, 2000