handles NaN (converts them to range_max)