<cfloat>

The <cfloat> header is the C++ version of the C standard <float.h> header. It defines parameters that characterize floating-point types in the same way <climits> does for the integral types. The native C++ header, <limits>, defines the same information (and more) using templates instead of macros.

There are three sets of macros, each describing a different fundamental type. For each type, the corresponding set of macros has a common prefix: float (FLT_), double (DBL_), and long double (LDBL_). Each set characterizes a floating-point value as a sign, a significand (sometimes called the mantissa), a base, and an exponent:

x = sign × significand × base exponent

In everyday arithmetic, we are used to working with a base of 10. (The base is also called the radix.) The most common bases for computer arithmetic, however, are 16 and 2. Many modern workstations use the IEC 60559 (IEEE 754) standard for floating-point arithmetic, which uses a base of 2.

The significand is a string of digits in the given base. There is an implied radix point at the start of the significand so the value of the significand is always less than 1. (A radix point is the generalization of a decimal point for any radix.)

A floating-point value is normalized if the first digit of its significand is nonzero, or if the entire value is 0. A value that is not normalized is denormalized.

The precision of a floating-point type is the maximum number of places in the significand. The range of a floating-point type depends primarily on the minimum and maximum values for the exponent.

<cfloat>

The value returned by each macro is implementation-defined because all the fundamental types are implementation-defined. The standard mandates minimum decimal precision and range for each floating-point type. In this section, the descriptions for the decimal characteristics of each type include the minimum value set by the standard.

Only FLT_RADIX expands to a constant expression. All other macros in <cfloat> expand to numeric expressions, but the values might not be compile-time constants.