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

Incorrect output from DecimalFormat(###0.0) in 1.1.6

XMLWordPrintable

    • x86
    • windows_nt



      Name: mf23781 Date: 05/07/98


      Using DecimalFormat(###0.0) produces formatted output as ollows: 00.5This should be 0.5 and indeed JDK 115 gets this right. 116 appears to add an extra 0 (although not one for every #).


      import java.text.*;
      public class test
      {

      public static void main(String argv[])
      {
      DecimalFormat test1 = new DecimalFormat("###0.0");
      StringBuffer test2 = new StringBuffer();
      FieldPosition test3 = new FieldPosition(0);

      test1.format(.5,test2,test3);
      System.out.println(test2);
      }
      }


      ======================================================================

            duke J. Duke
            miflemi Mick Fleming
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: