format function of NumberFormat/DecimalFormat

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: P4
    • None
    • Affects Version/s: 1.1.3
    • Component/s: core-libs
    • x86
    • windows_nt



      Name: nl37777 Date: 02/16/99


      String s = "";
      BigDecimal bd = new BigDecimal(""+4480.1900000000005);
      bd = bd.setScale(2, BigDecimal.ROUND_HALF_UP);
      System.out.println("Scale : " + bd.scale());
      System.out.println("Double : " + bd.doubleValue());
      double pValue = bd.doubleValue();
      System.out.println(pValue);
      java.text.DecimalFormat nf = (DecimalFormat) NumberFormat.getCurrencyInstance();
      s = nf.format(pValue);
      System.out.println("Return Value : " + s);

      for 4480.19 it always displays $4,480.18. But it works fine with other numbers.

      If BigDecimal is not used it works fine.
      (Review ID: 41248)
      ======================================================================

            Assignee:
            J. Duke
            Reporter:
            Norbert Lindenberg (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: