HP-UX Reference (11i v2 04/09) - 3 Library Functions A-M (vol 6)

f
fabs(3M) fabs(3M)
NAME
fabs( ), fabsf( ), fabsl( ), fabsw( ), fabsq( ) - absolute value functions
SYNOPSIS
#include <math.h>
double fabs(double x);
float fabsf(float x);
Itanium(R)-based System Only
long double fabsl(long double x);
extended fabsw(extended x);
quad fabsq(quad x);
DESCRIPTION
The fabs() function returns the absolute value of x,|x|.
fabsf() is a float version of fabs(); it takes a
float argument and returns a float result.
Itanium-based System Only
fabsl() is a long double version of fabs(); it takes a long double argument and returns a
long double result.
fabsw() is an extended version of fabs(); it takes an extended argument and returns an
extended result.
fabsq() is equivalent to fabsl() on HP-UX systems.
USAGE
To use
fabsf(), compile either with the default -Ae option or with the -Aa
option. For PA-RISC only,
the
-D_HPUX_SOURCE option must be used along with the
-Aa option.
To use (for Itanium-based systems)
fabsl(), fabsw(),orfabsq(), compile either with the default
-Ae option or with the -Aa and -D_HPUX_SOURCE
options. To use fabsw() or fabsq(), compile
with the
-fpwidetypes option.
To use these functions, make sure your program includes
<math.h>, and link in the math library by
specifying -lm on the compiler or linker command line.
For more information, see the HP-UX Floating-Point Guide.
RETURN VALUE
If x is ±INFINITY, fabs() returns +INFINITY.
If x is NaN,
fabs() returns NaN.
These functions raise no exceptions.
ERRORS
No errors are defined.
SEE ALSO
abs(3C), cabs(3M), ceil(3M), floor(3M), fmod(3M), rint(3M), math(5).
STANDARDS CONFORMANCE
fabs() : SVID3, XPG4.2, ANSI C, ISO/IEC C99 (including Annex F, "IEC 60559 floating-point arith-
metic")
fabsf(), fabsl() : ISO/IEC C99 (including Annex F, "IEC 60559 floating-point arithmetic")
Section 3284 Hewlett-Packard Company 1 HP-UX 11i Version 2: September 2004