Added HasNaN function and test