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

MathContext not working properly with MathContext.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 6
    • core-libs
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      jre1.6.0_01

      ADDITIONAL OS VERSION INFORMATION :
      java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, os.name=Windows XP,

      A DESCRIPTION OF THE PROBLEM :
      When i am executing :

      BigDecimal bd=new BigDecimal(421.82, new MathContext(2,RoundingMode.HALF_UP));
      System.out.println(bd.intValue());

      I am expecting the output : 422 instead I am getting 420.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Execute :

      BigDecimal bd=new BigDecimal(421.82, new MathContext(2,RoundingMode.HALF_UP));
      System.out.println(bd.intValue());


      REPRODUCIBILITY :
      This bug can be reproduced always.

            darcy Joe Darcy
            igor Igor Nekrestyanov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: