Details
-
Enhancement
-
Resolution: Fixed
-
P5
-
18
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"
"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"
Attachments
Issue Links
- relates to
-
JDK-8283146 Example in 4.3.1 uses deprecated API
- Closed