Slide 62
Slide 62 text
- BigDecimal(String) constructor should always be preferred over BigDecimal(Double) because using
BigDecimal(double)is unpredictable due to the inability of the double to represent 0.1 as exact 0.1.
- If double must be used for initializing a BigDecimal, use BigDecimal.valueOf(double), which converts
the Double value to String using Double.toString(double) method
- Rounding mode should be provided while setting the scale
- StripTrailingZeros chops off all the trailing zeros
- toString() may use scientific notation but, toPlainString() will never return exponentiation in its result
-
BigDecimal