Typo in JLS 8 Section 4.2.3
Hiram Hunt
hiramhunt at verizon.net
Fri Jun 3 20:09:19 UTC 2016
Hello,
In The Java Language Specification (Java SE 8 Edition)
near the end of section 4.2.3 (Floating-Point Types,
Formats, and Values) there is an explanation of the
behavior of NaN. There are three bulleted items.
After the second bulleted item, there are the words
"In particular, (x<y) == !(x>=y) will be false if x
or y is NaN".
The problem is that the second bulleted item has to do
with what happens if a NaN occurs as an operand of ==,
but the operands of == in the "In particular..." sentence
are booleans. The words really belong right after the
first bulleted item, which concerns the numerical
comparison operators.
Also, couldn't the expression be made simpler by dropping
the logical negation and changing the word "false" to "true"
in the misplaced text? Even shorter:
"In particular, (x<y) == (x>=y) if x or y is NaN."
-- Hiram Hunt (hiramhunt at verizon.net)
More information about the jls-jvms-spec-comments
mailing list