Narrower primitive types may be cast converted to wider types without affecting the magnitude of numeric values. See JLS, Section 5.1.2, "Widening Primitive Conversion" for more information. Conversion from int
or long
to float
, or long
to double
may lead to loss of precision (loss of least significant bits). No runtime exception occurs despite this loss.
...