[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


fabs

Compute the floating point absolute value.

Compatibility:

This function is compatible with the following targets:

ANSI

BeOS

EMB/RTOS

Mac OS

Palm OS

Win32


Prototype:
#include <math.h>

double fabs(double x);
float fabsf(float);
long double fabsl(long double);
Parameters:

Parameters for this function are:

x  
float, double or long double  
value to be computed  

Return:

fabs() returns the absolute value of x.

See Also:

"floor"

"ceil"

"fmod"

fabs() example:
#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