moved functionality of invalid2nan function to nansat