Fix misuses of std::numeric_limits<T>::min.