Fix comparison to Double.NaN

Equality comparison to these values is always false
Merge pull request #33 from naoliv/pull13

Fix comparison to Double.NaN