NAME
fabs(), fabsf(), fabsl(), fabsw(), fabsq() — absolute value functions
SYNOPSIS
#include <math.h>
double fabs(double x);
float fabsf(float x);
HP Integrity Server 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.
Integrity Server 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 Integrity servers)
fabsl(),
fabsw(),
or
fabsq(),
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 for HP Integrity servers
at the following site:
http://www.hp.com/go/fp.
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.
STANDARDS CONFORMANCE
fabs()
: SVID3, XPG4.2, ANSI C, ISO/IEC C99 (including Annex F, "IEC 60559 floating-point arithmetic")
fabsf(),
fabsl()
: ISO/IEC C99 (including Annex F, "IEC 60559 floating-point arithmetic")