Resolving ArithmeticException: "Non-terminating decimal expansion; no exact representable decimal result"
Consider the codeblock here, although this is not the actual code, this resembles what i am trying to do, and where the code is failing and throwing an ArithmeticException.
BigDecimal num1 = new BigDecimal("9.456"); BigDecimal num2 = new BigDecimal("43.76"); num1.divide(num2)
On the execution of line 3, i am getting an exception as
java.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result.
what could be the possible reason of this and also the resolution of course.