...
Code Block | ||
---|---|---|
| ||
// prints 0.1 System.out.println(new BigDecimal(""0.1"")); |
Risk Assessment
Using the BigDecimal
constructor that accepts decimal literals can lead to loss of precision.
...
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
References
[JLS 05]
...
FLP32-J. Range check before casting floating point numbers to narrower types 07. Floating Point (FLP) 07. Floating Point (FLP)