JDK-8283144 : Improve wording with respect to ordering positive and negative zero
  • Type: Enhancement
  • Component: specification
  • Sub-Component: language
  • Affected Version: 19
  • Priority: P5
  • Status: New
  • Resolution: Unresolved
  • Submitted: 2022-03-15
  • Updated: 2022-03-15
Related Reports
Relates :  
Description
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"