Why does BigDecimal divide cause rounding to happen even though the value should fit comfortably in 4 significant digits?
BigDecimal realPercent = new BigDecimal(1.25, new MathContext(4));
// 1.25
BigDecimal percentDivider = new BigDecimal(100, new MathContext(4));
realPercent = realPercent.divide(percentDivider, BigDecimal.ROUND_HALF_UP);
// 0.01
It's possible to make divide behave like I want by setting the precision on the method call, but it doesn't explain why it doesn't already do it.
realPercent.divide(percentDivider, 4, BigDecimal.ROUND_HALF_UP)
// 0.0125