...
When a
double
is demoted tofloat
, along double
is demoted todouble
orfloat
, or a value being represented in greater precision and range than required by its semantic type (see 6.3.1.8) is explicitly converted (including to its own type), if the value being converted can be represented exactly in the new type, it is unchanged. If the value being converted is in the range of values that can be represented but cannot be represented exactly, the result is either the nearest higher or nearest lower representable value, chosen in an implementation-defined manner. If the value being converted is outside the range of values that can be represented, the behavior is undefined.
Consequently, in implementations that do not allow for the representation of all numbers, conversions of too-small of numbers (between zero and FLT_MIN
) may result in undefined behavior.
...