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

Math.sqrt(Double.MIN_VALUE) returns NEGATIVE_INFINITY instead of NaN on Win32

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 1.2.0
    • core-libs
    • sparc
    • solaris_2.5



      Name: mgC56079 Date: 06/30/98



      According to JLS 20.11.12 Math.sqrt(Double.MIN_VALUE) should return Double.NaN.
      It returns Double.NEGATIVE_INFINITY on Win32 with jdk1.2beta4.
      Works correctly with jdk1.1.x/win32, jdk1.1.x/Solaris and jdk1.2beta4/Solaris.

      ==== Here is a test ====
      public class Sqrt {
      public static void main(String s[]) {
        System.out.println(Math.sqrt(Double.NEGATIVE_INFINITY));
      }
      }
      === Sample run (Win32, jdk1.2beta4J), wrong ===
      % java Sqrt
      Infinity
      === Sample run(Solaris or jdk1.1.x), correct ===
      % java Sqrt
      NaN

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

            darcy Joe Darcy
            mgorshen Mikhail Gorshenev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: