Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
div
Expand Minimize

fabs, fabsf

Calculates the absolute value of the floating-point argument.

double fabs( 
   double x 
);
float fabs(
   float x 
); // C++ only
long double fabs(long double _X
); // C++ only
float fabsf( 
   float x 
);

Parameter

x
Floating-point value.

Return Value

fabs returns the absolute value of its argument. There is no error return.

Input SEH Exception Matherr Exception
± QNAN,IND none _DOMAIN

Remarks

C++ allows overloading, so you can call overloads of fabs. In a C program, fabs always takes and returns a double.

Requirements

Function Required header Compatibility
fabs, fabsf <math.h> ANSI, Win 98, Win Me, Win NT, Win 2000, Win XP

For additional compatibility information, see Compatibility in the Introduction.

Libraries

All versions of the C run-time libraries.

Example

See the example for abs.

See Also

Floating-Point Support Routines | abs | _cabs | labs | Run-Time Routines and .NET Framework Equivalents

Show:
© 2015 Microsoft