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

jitc generates wrong results for string->float conversion

XMLWordPrintable

    • jit
    • sparc
    • solaris_2.5

      [5/16 sadhana]

      For following test, jitc generates wrnog results -

      sujay:test_dir5$ m t2.java
      public class t2 {

      public static void main(String argv[]) {
              String str_val = new String("-Inf");
              float floatDest = Float.valueOf( str_val ).floatValue();
                  
              isit("string->float conversion", floatDest,-1.0f/0.0f);
              System.out.println( floatDest );
      }

      public static void
          isit( String testexpression, float actual, float expected )
          {
              if ( actual == expected ){
                  System.out.print( "PAssed: " );
              } else {
                  System.out.print( "Failure: " );
                  System.out.print( testexpression );
                  System.out.print( " yields " );
                  System.out.println( actual );
                  System.out.print( " expected " );
                  System.out.println( expected );
              }
          }

      }

      sujay:test_dir5$ java -Djava.compiler=JIT t2
      Failure: string->float conversion yields 0
               expected -Inf
      0
      sujay:test_dir5$ java t2
      PAssed: -Inf
      sujay:test_dir5$

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: