You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Otherwise OrderedFloat is not ordered at all, breaking the assumptions of any algorithm that uses it.
The documentation for Ord says
Implementations of PartialEq, PartialOrd, and Ord must agree with each other. It's easy to accidentally make them disagree by deriving some of the traits and manually implementing others.
The following test fails:
externcrate ordered_float;use std::f64::NAN;use ordered_float::OrderedFloat;#[test]fnless_than_nan(){let x = OrderedFloat(1.0);let y = OrderedFloat(NAN);assert!(x < y);}
None of the tests in this crate cover using the comparison operators; they all use Ord::cmp directly. This should be fixed. The current code is unsound and could lead to unsafety.
The text was updated successfully, but these errors were encountered:
Otherwise
OrderedFloat
is not ordered at all, breaking the assumptions of any algorithm that uses it.The documentation for
Ord
saysThe following test fails:
None of the tests in this crate cover using the comparison operators; they all use
Ord::cmp
directly. This should be fixed. The current code is unsound and could lead to unsafety.The text was updated successfully, but these errors were encountered: