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
max
version that only allowsOrd
to something else, liketotal_max
orstrict_max
. - Implement
std::cmp::max
for floating point numbers, so thata.max(b)
is consistent withmax(a,b)
.
Metadata
Metadata
Assignees
Labels
No labels