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

sqe-lib : prototype :Tiger java.math.BigDecimal divideToIntegralValue(divisor,m

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 5.0
    • Fix Version/s: 5.0
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      tiger
    • CPU:
      x86
    • OS:
      windows_2000
    • Verification:
      Verified

      Description

      Tiger java.math.BigDecimal platform :win2000
      divideToIntegralValue(divisorBD,mc)

      for the following data point and MathContext
      String dividend = "123456789000";
      String divisor = "1";
      MathContext mc = new MathContext(9,RoundingMode.DOWN);

      I am getting the Exception.

      java.lang.ArithmeticException: Division impossible

      I am expecting the output as: 123456789000 with a scale of -3.

      The java prototype version used is:
      (build 1.5.0-internal-darcy_18_aug_2003_12_29)

      The Test program is:
      -------------------

      import java.math.*;
      public class Test {
          public static void main(String args[]) throws Exception {
              String dividend = "123456789000";
              String divisor = "1";
              BigDecimal dividendBD = new BigDecimal(dividend);
              BigDecimal divisorBD = new BigDecimal(divisor);
              MathContext mc = new MathContext(9,RoundingMode.DOWN);
              BigDecimal quotientDivideInteger = dividendBD.divideToIntegralValue(divisorBD,mc);
              System.out.println("quotientDivideInteger " + quotientDivideInteger.longValue() + " scale = " + quotientDivideInteger.scale());
           }
       }

      ---------------The output is----and java version used-------------

      D:\testing>java Test
      Exception in thread "main" java.lang.ArithmeticException: Division impossible
              at java.math.BigDecimal.divideToIntegralValue(BigDecimal.java:1464)
              at Test.main(Test.java:9)

      D:\testing>java -version
      java version "1.5.0-internal"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-internal-darcy_18_
      aug_2003_12_29)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b15, mixed mode)

      ---------expected output is:

      I am expecting the output as: 123456789000 with a scale of -3.

      ###@###.### 2003-09-03

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              darcy Joe Darcy
              Reporter:
              spandeorcl Shantaram Pande (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: