Why does the following return 1?
new BigDecimal(0.82).setScale(5, BigDecimal.ROUND_HALF_DOWN)
.compareTo(new BigDecimal(0.82))
I expect this to return 0 because BigDecimal.compareTo ignores scale according to its documentation:
Compares this
BigDecimalwith the specifiedBigDecimal. TwoBigDecimalobjects that are equal in value but have a different scale (like2.0and2.00) are considered equal by this method. [...]