-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Closed
Description
It's werid that std::cmp::max can't compare f64 numbers. I know that strictly speaking IEEE floats don't have total order this function expects, but still it's surprising (and partial_max is awkward to use).
And there's std::num::Float::max which works with f64 just fine (the docs don't even say how NaN is handled).
It bugs me that the two versions of max are not consistent in their strictness, and that the first-and-most-obvious max function in the stdlib "doesn't work" with a basic type in the language.
My suggestion:
- Rename the
maxversion that only allowsOrdto something else, liketotal_maxorstrict_max. - Implement
std::cmp::maxfor floating point numbers, so thata.max(b)is consistent withmax(a,b).
rap2hpoutre
Metadata
Metadata
Assignees
Labels
No labels