replaced INFINITY macro with query to numeric_limits