Narrower primitive types can be cast to wider types without any effect on the magnitude of numeric values. However, when the expressions are not _strictfp_, conversions from float to double may lose information about the overall magnitude of the converted value. \[[JLS 05|AA. Java References#JLS 05]\] Section value (see JLS Section 5.1.2, Widening Primitive Conversion). Wiki Markup
Conversion from int or long to float, or long to double can lead to loss of precision (loss of least significant bits). No runtime exception occurs despite the loss.
...
Wiki Markup |
---|
\[[JLS 05|AA. Java References#JLS 05]\] [Section 5.1.2, Widening Primitive Conversion|http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.2] |
...
INT32-J. Perform conversion from BigInteger to String and back properly 04. Integers (INT) 05. Floating Point (FLP)