My idea is that BigDecimal has unlimited precision, so when doing division, the computer doesn't know how much precision the result needs, so if you don't specify it, it will report an error
MathContext mc = new MathContext(2, RoundingMode.HALF_DOWN); //The precision is 2, the rounding mode is greater than 0.5 and 1, otherwise it is discarded. BigDecimal a = new BigDecimal(0.5); BigDecimal b = new BigDecimal(0.2); System.out.println(a.divide(b,mc));