[
https://issues.apache.org/jira/browse/GROOVY-3309?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18132831#comment-18132831
]
Paul King commented on GROOVY-3309:
-----------------------------------
For reference: the primitive half of this is now GROOVY-12538. When both
operands are
primitive double/float, > and >= were compiled with DCMPG/FCMPG and so returned
true
for NaN; that is fixed to match Java. Comparisons that go through the number
comparison runtime (e.g. Double.NaN > 0 with an int 0, or == on Double objects)
still
follow Double.compareTo/Double.equals, which is the open question this issue
raises.
> comparisons with NaN should always return false
> -----------------------------------------------
>
> Key: GROOVY-3309
> URL: https://issues.apache.org/jira/browse/GROOVY-3309
> Project: Groovy
> Issue Type: Bug
> Components: groovy-runtime
> Affects Versions: 1.5.7, 1.6-rc-2
> Environment: os x, jse 5 and 6
> Reporter: Andy Fyfe
> Priority: Major
> Fix For: 4.x
>
>
> The following assertions should all pass; the third fails.
> {code}
> assert !(Double.NaN == 0)
> assert !(Double.NaN < 0)
> assert !(Double.NaN > 0)
> {code}
> A NaN should also not equal a NaN.
> {code}assert Double.NaN != Double.NaN{code}
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)