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

1.1 Bug: 0.0f*-0.0f is not equal to -0.0f

XMLWordPrintable

    • 1.1
    • x86
    • windows_nt



      Name: dkC59003 Date: 04/26/99



      HotSpot does not pass the test below (return value is 97)
      in compiled mode (-Xcomp option is on):
      $ java -version
      java version "1.2"
      HotSpot VM (1.0fcs, mixed mode, build E)
      $ java -Xcomp b4211151
      $ echo $?
      97
      The same problem for sparc was reported by the bug #4211151 (fixed)

      ----------------------------------------------------------- b4211151.java
      import java.io.PrintStream;

      public class b4211151 {

          public static void main( String argv[] ) {
              System.exit(run(argv, System.out) + 95/*STATUS_TEMP*/);
          }

          public static int run(String args[], PrintStream out) {
            
      int overallStatus = 0;
            
      for (int i = 0; i < 3; i++) {
                  overallStatus += comp();
      }
      return (overallStatus == 0 ? 0/*STATUS_PASSED*/ : 2/*STATUS_FAILED*/);
          }

          static int comp() {
            
      float zerof = 0.0f;
            
      if (! Float.toString(zerof * - zerof).startsWith("-")) {
      return 2/*STATUS_FAILED*/;
      }
      return 0/*STATUS_PASSED*/;
          }
      }
      -----------------------------------------------------------

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

            mpalecznsunw Michael Paleczny (Inactive)
            dkhukhrosunw Dmitry Khukhro (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: