std::cmp::max fails.
-
std::cmp::max fails.
The error message: "the trait bound `f32: Ord` is not satisfied"
*belabored sigh* sometimes the most frustrating thing about Rust is that it does things correctly
-
std::cmp::max fails.
The error message: "the trait bound `f32: Ord` is not satisfied"
*belabored sigh* sometimes the most frustrating thing about Rust is that it does things correctly
@mcc `std::cmp::max_by(a, b, f32::total_cmp)`
-
@mcc `std::cmp::max_by(a, b, f32::total_cmp)`
@elomatreb @mcc i was about to post this, and https://docs.rs/ordered-float/latest/ordered_float/struct.OrderedFloat.html
-
std::cmp::max fails.
The error message: "the trait bound `f32: Ord` is not satisfied"
*belabored sigh* sometimes the most frustrating thing about Rust is that it does things correctly
@mcc you can't order floats. They obey nobody.
-
@mcc you can't order floats. They obey nobody.
@ratsnakegames @mcc i could order a float easily. Root beer for me please
-
@elomatreb @mcc i was about to post this, and https://docs.rs/ordered-float/latest/ordered_float/struct.OrderedFloat.html
@simon @elomatreb @mcc A more exhaustive list: https://docs.rs/typed_floats/latest/typed_floats/#similar-crates
-
std::cmp::max fails.
The error message: "the trait bound `f32: Ord` is not satisfied"
*belabored sigh* sometimes the most frustrating thing about Rust is that it does things correctly
@mcc In that case Rust is wrong.
Floats can be ordered, and the spec defines a total order.
It's Rust's subtyping relationship between PartialOrd and Ord that makes it impossible to implement more than one order.
-
@elomatreb @mcc i was about to post this, and https://docs.rs/ordered-float/latest/ordered_float/struct.OrderedFloat.html
@simon @elomatreb @mcc The wrapper approach is not that useful in practice, because not every struct containing a float is under one's control.
That should have really just worked out of the box.
-
@mcc In that case Rust is wrong.
Floats can be ordered, and the spec defines a total order.
It's Rust's subtyping relationship between PartialOrd and Ord that makes it impossible to implement more than one order.
@soc What is the total ordering with respect to NaNs?
-
@mcc you can't order floats. They obey nobody.
@ratsnakegames @mcc you gotta have a plan in place for foam control
-
@ratsnakegames @mcc i could order a float easily. Root beer for me please
@Aleums make it yourself
-
@soc What is the total ordering with respect to NaNs?
@mcc -NaNs -Inf -nums -0.0 +0.0 +nums +Inf +NaNs
(If I remember correctly.)
-
@Aleums make it yourself
@ratsnakegames @Aleums sudo make me a root beer float
-
@ratsnakegames @Aleums sudo make me a root beer float
@Aleums Not in sudoers file. This violation will be logged.
-
@mcc -NaNs -Inf -nums -0.0 +0.0 +nums +Inf +NaNs
(If I remember correctly.)
@mcc The spec technically allows some leeway around non-canonical encodings.
In practice, everyone uses the same integer shift/xor approach, which means that IEEE754's `totalOrder` predicate is ... a total order in pretty much every language/standard library.
-
@mcc you can't order floats. They obey nobody.
@ratsnakegames @mcc sure I can, there's a wide selection of them in my local fishing supply store
-
undefined oblomov@sociale.network shared this topic on