3 ms·
Your two functions are not equivalent. std::fmax handles NaN, but std::clamp does not.
by ChrisLomont 6y ago
Your two functions are not equivalent. std::fmax handles NaN, but std::clamp does not.
- brandmeyer 6y agoDepends on how the comparisons are ordered. Some of the orderings I've seen in here do respect NaN by virtue of `x > upper_bound` comparing false if either x or upper_bound are NaN.
- ChrisLomont 6y agoBoth functions are defined how they handle NaN by the standard. There is no ordering or implementation ambiguity by design.