Add regression tests for comparison with NaN
Fix NaN comparison bug
Merge pull request #747 from OskarLinde/nan_fix

NaN comparisons were inconsistent