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

"Math.min(0d, Double.MIN_VALUE)" equals "0"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 1.1.7
    • core-libs
    • sparc
    • solaris_2.6



      Name: dbT83986 Date: 03/09/99


      Maybe I'm missing something, but I seem to be getting weird results
      with Math.max() and Math.min() when comparing zero with MIN_VALUE
      MAX_VALUE. Below is the code, and then the results:

      System.out.println(Math.min(0d, Double.MIN_VALUE)); // Wrong
      0.0
      System.out.println(Math.min(0d, Double.MAX_VALUE));
      // 0.0
      System.out.println(Math.max(0d, Double.MIN_VALUE)); // Wrong
      4.9E-324
      System.out.println(Math.max(0d, Double.MAX_VALUE));
      // 1.7976931348623157E308
      System.out.println(0d > Double.MIN_VALUE)); // Wrong
      false
      System.out.println(0d > Double.MAX_VALUE);
      // false
      System.out.println(0d < Double.MIN_VALUE); // Wrong
      true
      System.out.println(0d < Double.MAX_VALUE);
      // true

      Results:

      0.0
      0.0
      4.9E-324
      1.7976931348623157E308
      false
      false
      true
      true
      (Review ID: 54459)
      ======================================================================

            apalanissunw Anand Palaniswamy (Inactive)
            dblairsunw Dave Blair (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: