-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
T-libs-apiRelevant to the library API team, which will review and decide on the RFC.Relevant to the library API team, which will review and decide on the RFC.
Description
Issue by pornel
Saturday Jan 31, 2015 at 18:28 GMT
For earlier discussion, see rust-lang/rust#21816
This issue was labelled with: A-libs in the Rust repository
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).
Metadata
Metadata
Assignees
Labels
T-libs-apiRelevant to the library API team, which will review and decide on the RFC.Relevant to the library API team, which will review and decide on the RFC.