macro/function
<cmath> <ctgmath>
fpclassify
| function | int fpclassify (float x);int fpclassify (double x);int fpclassify (long double x); |
|---|
Classify floating-point value
int that matches one of the classification macro constants, depending on the value of x:| value | description |
|---|---|
| FP_INFINITE | Positive or negative infinity (overflow) |
| FP_NAN | Not-A-Number |
| FP_ZERO | Value of zero |
| FP_SUBNORMAL | Sub-normal value (underflow) |
| FP_NORMAL | Normal value (none of the above) |
These macro constants of type int are defined in header <cmath> (<math.h>).
In C, this is implemented as a macro, but the type of x shall be float, double or long double.
In C++, it is implemented with function overloads for each floating-point type.
Parameters
- x The value to classify.
Return value
One of the followoingint values: FP_INFINITE, FP_NAN, FP_ZERO, FP_SUBNORMAL or FP_NORMAL.Example
|
|
Output:
infinite positive or unsigned
See also
- isfinite
- Is finite value (macro)
- isnan
- Is Not-A-Number (macro/function)
- isnormal
- Is normal (macro/function)
- signbit
- Sign bit (macro/function)