A prvalue of an integer type or of an unscoped enumeration type can be converted to
a prvalue of a floating-point type
. The result is exact if possible
. If the value being
converted is in the range of values that can be represented but the value cannot be
represented exactly, it is an
implementation-defined choice of either the next lower or higher representable
value
. [
Note 2:
Loss of precision occurs if the integral value cannot be represented
exactly as a value of the floating-point type
. —
end note]
If the value being converted is
outside the range of values that can be represented, the behavior is undefined
. If the
source type is
bool, the value
false is converted to zero and the value
true is converted to one
.