Handled NaN and Infinite numbers