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

Double comparison between minimum value and 0 is incorrect

XMLWordPrintable

    • generic
    • generic

      FULL PRODUCT VERSION :
      openjdk version "1.8.0_92"
      OpenJDK Runtime Environment (Zulu 8.15.0.1-macosx) (build 1.8.0_92-b15)
      OpenJDK 64-Bit Server VM (Zulu 8.15.0.1-macosx) (build 25.92-b15, mixed mode)

      FULL OS VERSION :
      Mac OS X 10.11.4

      A DESCRIPTION OF THE PROBLEM :
      The Java Runtime produces incorrect values when performing double comparisons between 0 and min value.

      Double.MIN_VALUE > 0.0 is reported as true, even though it shouldn't be.

      THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Yes

      THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run above source code after compiling with javac

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      Expected: Silent exit.
      Actual: Prints BUG.
      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class Test {
          public static void main(String[] args) {
              if (Double.MIN_VALUE > 0.0) {
                  System.out.println("BUG");
              }
          }
      }
      ---------- END SOURCE ----------

            psonal Pallavi Sonal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: