Asked • 04/27/19

ArithmeticException: "Non-terminating decimal expansion; no exact representable decimal result"?

Why does the following code raise the exception shown below? BigDecimal a = new BigDecimal("1.6"); BigDecimal b = new BigDecimal("9.2"); a.divide(b) // results in the following exception: java.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result.

1 Expert Answer

By:

Larry C. answered • 04/28/19

Tutor
4.9 (294)

Computer Science and Mathematics professional

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.