You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Doing the same thing also throws in java. It is because precision is 0. As I know, 0 precision means unlimited precision and means give me the exact result. So, we are asking the exact result from this operation but the exact result cannot be obtained with a non-terminating decimal expansion(0.3333...).
Exception in thread "main" java.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result.
at java.math.BigDecimal.divide(BigDecimal.java:1693)
at java.math.BigDecimal.divide(BigDecimal.java:1726)
at Main.main(Main.java:23)
Describe the bug
Big(1).divideWithMathContext(Big(3), new MC(0, RoundingMode.CEILING)).numberValue()
1/3 ceiling
i want the result is 1. What should I do?
The text was updated successfully, but these errors were encountered: