Typo in JLS 8 Section 4.2.3

Alex Buckley alex.buckley at oracle.com
Wed Jun 22 23:51:34 UTC 2016


Yes, I see what you mean about the "In particular" of the second bullet 
being better off in the first bullet.

As for the form of the == expression, it depends what kind of weird 
behavior you're trying to emphasize. Sure, it's weird that the truth of 
x<y is the same as the truth of x>=y, but it's also weird that something 
you would expect to be true -- the agreement of x<y and !(x>=y) -- is 
false. So, I don't propose to reformulate the example.

Alex

On 6/3/2016 1:09 PM, Hiram Hunt wrote:
> 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