...
Conversion from int
or long
to float
or from long
to double
can lead to loss of precision (loss of least significant bits). In these cases, the resulting floating-point value is a rounded version of the integer value, using IEEE 754 round-to-nearest mode. Despite this loss of precision, the JLS requires that the conversion and rounding occur silently, that is, without any runtime exception. See the JLS, §5.1.2, "Widening Primitive Conversion" [JLS 2005] for more information. Conversions from integral types smaller than int
to a floating-point type and conversions from int
to double
can never result in a loss of precision. Consequently, programs must ensure that conversions from an int
or long
to a floating-point type, or from long
to double
do not result in a loss of required precision.
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="953697ff7d83f0e3-34d844c1-4caa4cff-b399b7ee-248351d404fe974e9abd3c6f"><ac:plain-text-body><![CDATA[ | [[JLS 2005 | AA. Bibliography#JLS 05]] | [§5.1.2, Widening Primitive Conversion | http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.2] | ]]></ac:plain-text-body></ac:structured-macro> |
...