NANs are never equal, fixes #750
Merge pull request #751 from asm89/fix-nan-behaviour