...
Automatic detection of casts that can lose precision is straightforward. Sound determination of whether those casts correctly reflect the intent of the programmer is infeasible in the general case. Heuristic warnings could be useful.
Related Guidelines
"FLP36-C. Beware of precision loss when converting integral types to floating point" | |
"FLP36-CPP. Beware of precision loss when converting integral types to floating point" |
Bibliography
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="5eb097defa40413a-e8fb58c8-476c427c-a773bda3-dbe7af01e0d47690df6d3e75"><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> |
...