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

loop statements with double-type index, can ends at incorrect index.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 1.4.2, 5.0
    • core-libs
    • x86
    • windows_2000, windows_xp



      Name: gm110360 Date: 11/07/2003


      FULL PRODUCT VERSION :
      java version "1.4.1_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
      Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)

      A DESCRIPTION OF THE PROBLEM :
      look the source and result.

      while() and probably do...while()
      produces same results.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      ----------------------------------------
      result:

       0.70
       0.80
       0.90
       1.00

      but, if the initial value becomes 0.8 ,

       0.80
       0.90
      ---------------------------------------

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.text.* ;

      class Test
      {
      static NumberFormat f = NumberFormat.getNumberInstance() ;
      static
      {
      ( (DecimalFormat)f ).applyPattern( " #0.00;-" ) ;
      }

      public static void main( String[] param )
      {
      for( double a=0.7 ; a < 1 ; a += 0.1 )
      {
      System.out.println( f.format(a) ) ;
      }
      }
      }
      ---------- END SOURCE ----------
      (Incident Review ID: 178890)
      ======================================================================

            darcy Joe Darcy
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: