HP-UX Reference (11i v1 00/12) - 3 Library Functions A-M (vol 6)
__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man3/!!!intro.3c
________________________________________________________________
___ ___
f
fpclassify(3M) fpclassify(3M)
NAME
fpclassify() - floating-point operand 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 fpclassify() macro can be used with either double or float arguments, and classifies the
argument based on its type.
The ISO/ANSI C committee has approved the fpclassify() macro for inclusion in the forthcoming
C9X draft standard. The fpclassify() macro implements the class() function recommended by
the IEEE-754 standard for floating-point arithmetic.
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.
The fpclassify() macro, used in conjunction with the signbit() macro, replaces the fpclas-
sify()
and fpclassifyf() functions, which are obsolete and are no longer supported.
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 these functions never result in an error.
ERRORS
No errors are defined.
EXAMPLE
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) ) {
/*...*/
}
SEE ALSO
isfinite(3M), isinf(3M), isnan(3M),isnormal(3M), signbit(3M), math(5).
HP-UX Release 11i: December 2000 − 1 − Section 3−−255
___
___