updated function 9 in number lib to check for NaN first