NAME
fpclassify() — floating-point value classification macro
SYNOPSIS
#include <math.h>
int fpclassify(
floating-type
x);
DESCRIPTION
The
fpclassify()
macro classifies its argument value as NaN, infinite, normalized,
denormalized, or zero.
The argument must be of floating type, and classification is
based on the type of the argument. For HP Integrity servers, the argument
can be any floating type. For PA-RISC, the argument must be
either
double
or
float.
The
fpclassify()
macro, used in conjunction with the
signbit()
macro, replaces the
fpclassify()
and
fpclassifyf()
functions, which are obsolete and are no longer supported.
USAGE
To use the
fpclassify()
macro, compile either with the default
-Ae
option or with the
-Aa
and
-D_HPUX_SOURCE
options. Make sure your program includes
<math.h>.
Link in the math library by specifying
-lm
on the compiler or linker command line.
RETURN VALUE
The
fpclassify()
macro returns the value of the number classification macro appropriate
to the type and value of its argument.
The value returned is one of the following macros,
which are defined in
<math.h>:
FP_NORMAL Normalized
FP_ZERO Zero
FP_INFINITE Infinity
FP_SUBNORMAL Denormalized
FP_NAN NaN
Every possible argument value falls into one of these categories,
so this macro never results in an error.
The macro raises no exceptions.
ERRORS
No errors are defined.
EXAMPLES
Take certain actions if
x
is either a denormalized
float
value or zero:
#include <math.h>
/*...*/
int class;
float x;
/*...*/
class = fpclassify(x);
if ( (class == FP_SUBNORMAL) || (class == FP_ZERO) ) {
/*...*/
}
STANDARDS CONFORMANCE
fpclassify(): ISO/IEC C99