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

4.2.3: Improve wording w.r.t. positive and negative zero

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P5 P5
    • 19
    • 18
    • specification

      JLS 4.2.3 contains the sentence:

      "Except for NaN, floating-point values are ordered. Arranged from smallest to largest, they are negative infinity, negative finite nonzero values, positive and negative zero, positive finite nonzero values, and positive infinity. "

      From the point of view of the floating-point == operator, -0.0 and +0.0 are in the same equivalence class, -0.0 == +0.0 is true. However, for the ordering imposed by Double.compare/Double.compareTo, -0.0 is less than +0.0.

      Therefore, it would be preferable if instead of saying

      " positive and negative zero"

      the sentence in question said

      " negative and positive zero"

            gbierman Gavin Bierman
            darcy Joe Darcy
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: