[ 
https://issues.apache.org/jira/browse/GROOVY-4018?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

John Wagenleitner resolved GROOVY-4018.
---------------------------------------
       Resolution: Fixed
         Assignee: John Wagenleitner
    Fix Version/s:     (was: 3.x)
                   2.6.0-alpha-2

Thanks for reporting the issue.

> Make the Groovy truth value of NaN be false
> -------------------------------------------
>
>                 Key: GROOVY-4018
>                 URL: https://issues.apache.org/jira/browse/GROOVY-4018
>             Project: Groovy
>          Issue Type: Improvement
>          Components: groovy-runtime
>            Reporter: Steve Tekell
>            Assignee: John Wagenleitner
>              Labels: breaking
>             Fix For: 2.6.0-alpha-2
>
>
> Similar to null and empty-string, have Groovy evaluate NaN as false rather 
> than true.
> {noformat}
> def result = a?.b?.calcX(...)
> if (result) { 
>   // now I have a valid non-null number
> }
> {noformat}
> This is how JavaScript treats NaN and like other Groovy design choices, it 
> just makes sense.
> Discussed in this thread
> http://old.nabble.com/Shouldn't-the-Groovy-truth-value-of-NaN-be-false--tt27348256.html
> That is, if NaN was false the following should work:
> assert !(Double.NaN)
> assert !((Double.NaN as Boolean) == true)
> assert ((Double.NaN as Boolean) == false)



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to