
Envoyé par
C99
7.12 Mathematics <math.h>
...
6 The number classification macros
FP_INFINITE
FP_NAN
FP_NORMAL
FP_SUBNORMAL
FP_ZERO
represent the mutually exclusive kinds of floating-point values. They expand to integer
constant expressions with distinct values. Additional implementation-defined floating-
point classifications, with macro definitions beginning with FP_ and an uppercase letter,
may also be specified by the implementation.
...
...
7.12.3.1 The fpclassify macro
Synopsis
1 #include <math.h>
int fpclassify(real-floating x);
Description
2 The fpclassify macro classifies its argument value as NaN, infinite, normal,
subnormal, zero, or into another implementation-defined category.First, an argument
represented in a format wider than its semantic type is converted to its semantic type.
Then classification is based on the type of the argument.
Returns
3 The fpclassify macro returns the value of the number classification macro
appropriate to the value of its argument.
4 EXAMPLE The fpclassify macro might be implemented in terms of ordinary functions as
#define fpclassify(x) \
((sizeof (x) == sizeof (float)) ?_ _fpclassifyf(x) : \
(sizeof (x) == sizeof (double)) ? _ _fpclassifyd(x) : \
__fpclassifyl(x))
Partager