Fixed incorrect use of std::fmax/fmin.