The <cfloat> header is the C++ wrapper for the C standard <float.h> header. It defines parameters that characterize floating point types. See <climits> for the C characterization of the integral types.
The native C++ header, <limits>, defines the same information (and more), but without cumbersome macros. When writing new C++ code, use <limits> instead of <cfloat>.
There are three sets of macros, each set describing a different fundamental type. For each type, the set of macros have a common prefix: float (FLT_), double (DBL_), and long double (LDBL_). Each set characterizes a floating point value as a sign, a significant, and an exponent:
x = sign × significand × base exponent
A normalized floating point value is zero, or the first digit of its significand is non-zero. (Some floating point implementations do not store the first bit of a significand because it is known to be 1 when the entire value is not zero.)
Only FLT_RADIX expands to a constant expression. All other macros in <cfloat> expand to numeric expressions, but the values might not be constant.
int DBL_DIG
Number of significant decimal digits for any number that can be stored in a double.
double DBL_EPSILON
The difference between 1 and the smallest value greater than one that can be stored in a double.
int DBL_MANT_DIG
Number of FLT_RADIX digits in the significand of a double.
double DBL_MAX
Maximum finite double value.
int DBL_MAX_10_EXP
Maximum decimal exponent for a finite double.
int DBL_MAX_EXP
Maximum exponent of a FLT_RADIX base for a finite double.
double DBL_MIN
Minimum normalized, positive double value.
int DBL_MIN_10_EXP
Minimum negative decimal exponent for a normalized double.
int DBL_MIN_EXP
Minimum negative exponent of a FLT_RADIX base for a normalized double.
int FLT_DIG
Number of significant decimal digits for any number that can be stored in a float.
float FLT_EPSILON
The difference between 1 and the smallest value greater than one that can be stored in a float.
int FLT_MANT_DIG
Number of FLT_RADIX digits in the significand of a float.
float FLT_MAX
Maximum finite float value.
int FLT_MAX_10_EXP
Maximum decimal exponent for a finite float.
int FLT_MAX_EXP
Maximum exponent of a FLT_RADIX base for a finite float.
float FLT_MIN
Minimum normalized, positive float value.
int FLT_MIN_10_EXP
Minimum negative decimal exponent for a normalized float.
int FLT_MIN_EXP
Minimum negative exponent of a FLT_RADIX base for a normalized float.
int FLT_RADIX
The FLT_RADIX macro is an integer that specifies the radix for the floating point implementation. For example, IEC 60559 (IEEE 754) has a FLT_RADIX of 2.
int FLT_ROUNDS
The FLT_ROUNDS macro specifies how the implementation rounds floating point numbers. Table 13-2 lists the possible values. An implementation can define additional values with other meanings.
| Value | Description |
|---|---|
| -1 | indeterminable |
| 0 | rounds towards zero |
| 1 | rounds to nearest |
| 2 | rounds up (to positive infinity) |
| 3 | rounds down (to negative infinity) |
int LDBL_DIG
Number of significant decimal digits for any number that can be stored in a long double.
long double LDBL_EPSILON
The difference between 1 and the smallest value greater than one that can be stored in a long double.
int LDBL_MANT_DIG
Number of FLT_RADIX digits in the significand of a long double.
long double LDBL_MAX
Maximum finite long double value.
int LDBL_MAX_10_EXP
Maximum decimal exponent for a finite long double.
int LDBL_MAX_EXP
Maximum exponent of a FLT_RADIX base for a finite double.
long double LDBL_MIN
Minimum normalized, positive long double value.
int LDBL_MIN_10_EXP
Minimum negative decimal exponent for a normalized long double.
int LDBL_MIN_EXP
Minimum negative exponent of a FLT_RADIX base for a normalized long double.