added NaN test for atan2