Range and Precision of Real Floating Types
The macros
listed in Table 1-26 are
defined in the header file
float.h
to represent the range and the precision
of the types float
,
double
, and long
double
. The macro names are formed using the
prefixes FLT for float,
DBL for double, and
LDBL for long double. The
macros FLT_RADIX and FLT_ROUNDS
apply to all three floating types.
|
Macro name |
Purpose |
FLT_RADIX |
Base (or radix) of the exponential notation |
FLT_ROUNDS |
Indicates how rounding is performed on values that cannot be represented exactly:
|
FLT_MANT_DIG DBL_MANT_DIG LDBL_MANT_DIG |
The number of digits in the mantissa to base
|
FLT_MIN_EXP DBL_MIN_EXP LDBL_MIN_EXP |
Minimum value of the exponent to base |
FLT_MAX_EXP DBL_MAX_EXP LDBL_MAX_EXP |
Maximum value of the exponent to base |
The macros listed in Table 1-26 document the range
and precision of all real floating types. In actual programs, such
information is most often needed for decimal
(base 10) notation. Accordingly, you can use the macros for type
float listed Table 1-27, and
which are defined in float.h.
|
Macro name |
Purpose |
FLT_DIG |
Precision as a number of decimal digits |
FLT_MIN_10_EXP |
Minimum negative exponent to base 10 |
FLT_MAX_10_EXP |
Maximum positive exponent to base 10 ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access