Similar to null and empty-string, have Groovy evaluate NaN as false rather than true.
Discussed in this thread
That is, if NaN was false the following should work:
assert !((Double.NaN as Boolean) == true)
assert ((Double.NaN as Boolean) == false)