Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6812880

AssertionError in BigDecimal.remainder

XMLWordPrintable

    • b01
    • b04
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.6.0_14-ea"
      Java(TM) SE Runtime Environment (build 1.6.0_14-ea-b01)
      OpenJDK Client VM (build 14.0-b10, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      BigDecimal.remainder throws Exception

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      See test case

      ACTUAL -
      AssertionError

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "main" java.lang.AssertionError: this MutableBigInteger can't be fit into long
      at java.math.MutableBigInteger.toLong(MutableBigInteger.java:129)
      at java.math.MutableBigInteger.divide(MutableBigInteger.java:930)
      at java.math.BigDecimal.divideAndRound(BigDecimal.java:1416)
      at java.math.BigDecimal.setScale(BigDecimal.java:2377)
      at java.math.BigDecimal.setScale(BigDecimal.java:2310)
      at java.math.BigDecimal.divideToIntegralValue(BigDecimal.java:1710)
      at java.math.BigDecimal.divideAndRemainder(BigDecimal.java:1865)
      at java.math.BigDecimal.remainder(BigDecimal.java:1807)
      at it.prodata.gest.test.Test.main(Test.java:79)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class Test {
      public static void main(String s[]) {
      BigDecimal bd1 = new BigDecimal("200000000000000000000000000000");
      BigDecimal bd2 = BigDecimal.valueOf(97);
      System.out.println(bd1.remainder(bd2));
      }
      }

      ---------- END SOURCE ----------

      Release Regression From : 6u12
      The above release value was the last known release where this
      bug was not reproducible. Since then there has been a regression.

            alanb Alan Bateman
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: