System.out.println(new BigDecimal(9.99)); // 9.9900000000000002131628207280300557613372802734375System.out.println(new BigDecimal(9.99).setScale(2, BigDecimal.ROUND_CEILING)); // 10.00System.out.println(new BigDecimal(9.55)); // 9.550000000000000710542735760100185871124267578125System.out.println(new BigDecimal(9.55).setScale(2, BigDecimal.ROUND_CEILING)); // 9.56System.out.println(new BigDecimal(9.1)); // 9.0999999999999996447286321199499070644378662109375System.out.println(new BigDecimal(9.1).setScale(2, BigDecimal.ROUND_CEILING)); // 9.10System.out.println(new BigDecimal(-9.44)); // -9.4399999999999995026200849679298698902130126953125System.out.println(new BigDecimal(-9.44).setScale(2, BigDecimal.ROUND_CEILING)); // -9.43System.out.println(new BigDecimal(-9.11)); // -9.1099999999999994315658113919198513031005859375System.out.println(new BigDecimal(-9.11).setScale(2, BigDecimal.ROUND_CEILING)); // -9.10System.out.println(new BigDecimal(-9.1)); // -9.0999999999999996447286321199499070644378662109375System.out.println(new BigDecimal(-9.1).setScale(2, BigDecimal.ROUND_CEILING)); // -9.09System.out.println(new BigDecimal(9.44)); // 9.4399999999999995026200849679298698902130126953125System.out.println(new BigDecimal(9.44).setScale(2, BigDecimal.ROUND_DOWN)); // 9.43System.out.println(new BigDecimal(9.11)); // 9.1099999999999994315658113919198513031005859375System.out.println(new BigDecimal(9.11).setScale(2, BigDecimal.ROUND_DOWN)); // 9.10System.out.println(new BigDecimal(9.1)); // 9.0999999999999996447286321199499070644378662109375System.out.println(new BigDecimal(9.1).setScale(2, BigDecimal.ROUND_DOWN)); // 9.09System.out.println(new BigDecimal(-9.44)); // -9.4399999999999995026200849679298698902130126953125System.out.println(new BigDecimal(-9.44).setScale(2, BigDecimal.ROUND_DOWN)); // -9.43System.out.println(new BigDecimal(-9.11)); // -9.1099999999999994315658113919198513031005859375System.out.println(new BigDecimal(-9.11).setScale(2, BigDecimal.ROUND_DOWN)); // -9.10System.out.println(new BigDecimal(-9.1)); // -9.0999999999999996447286321199499070644378662109375System.out.println(new BigDecimal(-9.1).setScale(2, BigDecimal.ROUND_DOWN)); // -9.09System.out.println(new BigDecimal(9.44)); // 9.4399999999999995026200849679298698902130126953125System.out.println(new BigDecimal(9.44).setScale(2, BigDecimal.ROUND_FLOOR)); // 9.43System.out.println(new BigDecimal(9.11)); // 9.1099999999999994315658113919198513031005859375System.out.println(new BigDecimal(9.11).setScale(2, BigDecimal.ROUND_FLOOR)); // 9.10System.out.println(new BigDecimal(9.1)); // 9.0999999999999996447286321199499070644378662109375System.out.println(new BigDecimal(9.1).setScale(2, BigDecimal.ROUND_FLOOR)); // 9.09System.out.println(new BigDecimal(-9.99)); // -9.9900000000000002131628207280300557613372802734375System.out.println(new BigDecimal(-9.99).setScale(2, BigDecimal.ROUND_FLOOR)); // -10.00System.out.println(new BigDecimal(-9.55)); // -9.550000000000000710542735760100185871124267578125System.out.println(new BigDecimal(-9.55).setScale(2, BigDecimal.ROUND_FLOOR)); // -9.56System.out.println(new BigDecimal(-9.1)); // -9.0999999999999996447286321199499070644378662109375System.out.println(new BigDecimal(-9.1).setScale(2, BigDecimal.ROUND_FLOOR)); // -9.10System.out.println(new BigDecimal(9.1)); // 9.0999999999999996447286321199499070644378662109375System.out.println(new BigDecimal(9.1).setScale(2, BigDecimal.ROUND_HALF_DOWN)); // 9.10System.out.println(new BigDecimal(-9.1)); // -9.0999999999999996447286321199499070644378662109375System.out.println(new BigDecimal(-9.1).setScale(2, BigDecimal.ROUND_HALF_DOWN)); // -9.10System.out.println(new BigDecimal(9.1)); // 9.0999999999999996447286321199499070644378662109375System.out.println(new BigDecimal(9.1).setScale(2, BigDecimal.ROUND_HALF_EVEN)); // 9.10System.out.println(new BigDecimal(-9.1)); // -9.0999999999999996447286321199499070644378662109375System.out.println(new BigDecimal(-9.1).setScale(2, BigDecimal.ROUND_HALF_EVEN)); // -9.10System.out.println(new BigDecimal(9.1)); // 9.0999999999999996447286321199499070644378662109375System.out.println(new BigDecimal(9.1).setScale(2, BigDecimal.ROUND_HALF_UP)); // 9.10System.out.println(new BigDecimal(-9.1)); // -9.0999999999999996447286321199499070644378662109375System.out.println(new BigDecimal(-9.1).setScale(2, BigDecimal.ROUND_HALF_UP)); // -9.10System.out.println(new BigDecimal(9.99)); // 9.9900000000000002131628207280300557613372802734375System.out.println(new BigDecimal(9.99).setScale(2, BigDecimal.ROUND_UP)); // 10.00System.out.println(new BigDecimal(9.55)); // 9.550000000000000710542735760100185871124267578125System.out.println(new BigDecimal(9.55).setScale(2, BigDecimal.ROUND_UP)); // 9.56System.out.println(new BigDecimal(9.1)); // 9.0999999999999996447286321199499070644378662109375System.out.println(new BigDecimal(9.1).setScale(2, BigDecimal.ROUND_UP)); // 9.10System.out.println(new BigDecimal(-9.99)); // -9.9900000000000002131628207280300557613372802734375System.out.println(new BigDecimal(-9.99).setScale(2, BigDecimal.ROUND_UP)); // -10.00System.out.println(new BigDecimal(-9.55)); // -9.550000000000000710542735760100185871124267578125System.out.println(new BigDecimal(-9.55).setScale(2, BigDecimal.ROUND_UP)); // -9.56System.out.println(new BigDecimal(-9.1)); // -9.0999999999999996447286321199499070644378662109375System.out.println(new BigDecimal(-9.1).setScale(2, BigDecimal.ROUND_UP)); // -9.10