...
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.
Conversion rules:
...
From
...
To
...
Description
...
int or long
...
integral type T
...
Sign extend corresponding 2's complement form
...
char
...
integral type T
...
Also, see EXP08-J. Be aware of integer promotions in binary operators.
Noncompliant Code Example
...
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] |
...