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
java.lang.ArithmeticException: Division impossible
at java.math.BigDecimal.divideToIntegralValue(BigDecimal.java:1783)
at java.math.BigDecimal.divideAndRemainder(BigDecimal.java:1916)
at java.math.BigDecimal.remainder(BigDecimal.java:1850)
at scala.math.BigDecimal.remainder(BigDecimal.scala:256)
at scala.math.BigDecimal.$percent(BigDecimal.scala:260)
at .(:8)
at .()
at .(:11)
at .()
at $print()
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:704)
at scala.tools.nsc.interpreter.IMain$Request$$anonfun$14.apply(IMain.scala:920)
at scala.tools.nsc.interpreter.Line$$anonfun$1.apply$mcV$sp(Line.scala:43)
at scala.tools.nsc.io.package$$anon$2.run(package.scala:25)
at java.lang.Thread.run(Thread.java:662)
Whereas in 2.8 you get:
res0: scala.math.BigDecimal = 0.513676093799207
This has to do with the addition of the MathContext object. That object was added to limit decimal expansion of, e.g. BigDecimal(1) / BigDecimal(3), but introduces problems for the remainder operation.
The text was updated successfully, but these errors were encountered:
Runing the following in Scala 2.9.1 or more recent:
BigDecimal("23953295732957329573295379352353252353253") % BigDecimal(math.Pi)
results in:
java.lang.ArithmeticException: Division impossible
at java.math.BigDecimal.divideToIntegralValue(BigDecimal.java:1783)
at java.math.BigDecimal.divideAndRemainder(BigDecimal.java:1916)
at java.math.BigDecimal.remainder(BigDecimal.java:1850)
at scala.math.BigDecimal.remainder(BigDecimal.scala:256)
at scala.math.BigDecimal.$percent(BigDecimal.scala:260)
at .(:8)
at .()
at .(:11)
at .()
at $print()
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:704)
at scala.tools.nsc.interpreter.IMain$Request$$anonfun$14.apply(IMain.scala:920)
at scala.tools.nsc.interpreter.Line$$anonfun$1.apply$mcV$sp(Line.scala:43)
at scala.tools.nsc.io.package$$anon$2.run(package.scala:25)
at java.lang.Thread.run(Thread.java:662)
Whereas in 2.8 you get:
res0: scala.math.BigDecimal = 0.513676093799207
This has to do with the addition of the MathContext object. That object was added to limit decimal expansion of, e.g. BigDecimal(1) / BigDecimal(3), but introduces problems for the remainder operation.
The text was updated successfully, but these errors were encountered: