java.lang.ArithmeticException: Division impossible

Scala JIRA | Erik Osheim | 6 years ago
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    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( at java.math.BigDecimal.divideAndRemainder( at java.math.BigDecimal.remainder( at scala.math.BigDecimal.remainder(BigDecimal.scala:256) at scala.math.BigDecimal.$percent(BigDecimal.scala:260) at .<init>(<console>:8) at .<clinit>(<console>) at .<init>(<console>:11) at .<clinit>(<console>) at $print(<console>) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke( at sun.reflect.DelegatingMethodAccessorImpl.invoke( at java.lang.reflect.Method.invoke( at$ at$Request$$anonfun$14.apply(IMain.scala:920) at$$anonfun$1.apply$mcV$sp(Line.scala:43) at$$anon$ at 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.

    Scala JIRA | 6 years ago | Erik Osheim
    java.lang.ArithmeticException: Division impossible
  2. 0

    BigDecimal differences

    Google Groups | 5 years ago | Viktoras Agejevas
    java.lang.ArithmeticException: Division impossible
  3. 0

    i thought i understood the modulo operator. guess not quite yet.

    Coderanch | 2 years ago | Campbell Ritchie
    java.lang.ArithmeticException: Division by zero
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ArithmeticException

      Division impossible

      at java.math.BigDecimal.divideToIntegralValue()
    2. Java RT
      1. java.math.BigDecimal.divideToIntegralValue(
      2. java.math.BigDecimal.divideAndRemainder(
      3. java.math.BigDecimal.remainder(
      3 frames
    3. Scala
      1. scala.math.BigDecimal.remainder(BigDecimal.scala:256)
      2. scala.math.BigDecimal.$percent(BigDecimal.scala:260)
      2 frames