Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Edited by NavBot

...

Code Block
bgColor#ccccff
// 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.

...

FLP32-J. Range check before casting floating point numbers to narrower types            07. Floating Point (FLP)      07. Floating Point (FLP      08. Object Orientation (OBJ)