groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Winnebeck, Jason" <>
Subject Is NaN ==/!= NaN guaranteed to be consistent in all Groovy versions?
Date Mon, 21 Sep 2015 14:14:50 GMT
I see in Groovy that == and != work to compare variables against NaN. The rationale seems to
be that compareTo is used instead of primitive comparisons or equals. Is this behavior guaranteed
to be defined this way in all future versions of Groovy?

I've come across some Groovy code that is doing "x != Float.NaN" and in all of the test cases
it seems to work. I ask because I'm afraid of primopts or static compiler in the future perhaps
replacing the float to float comparison with a primitive !=, which returns false always in
Java, but if this is a locked in behavior for Groovy, then I won't worry about refactoring
existing code.

I see that addresses this and Jochen responded
to it but it was left open instead of closed as "won't fix", which concerns me that Groovy
team may introduce a breaking change in the future.


This email message and any attachments are for the sole use of the intended recipient(s).
Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the
intended recipient, please contact the sender by reply email and destroy all copies of the
original message and any attachments.

View raw message