java.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result
do this:
RoundingMode DEFAULT_ROUNDING_MODE = RoundingMode.HALF_UP;
int DIVIDE_SCALE = 10;
BigDecimal op1, op2
...
BigDecimal result = op1.divide(op2, DIVIDE_SCALE, DEFAULT_ROUNDING_MODE);
and you will be happy.
No comments:
Post a Comment
comments where you are promoting your business will be marked as SPAM :o)