Point out that total_cmp is no strict superset of partial comparison
Partial comparison and total_cmp are not equal. This helps preventing the mistake of creating float wrappers that base their Ord impl on total_cmp and their PartialOrd impl on the PartialOrd impl of the float type. PartialOrd and Ord are required to agree with each other.
This commit is contained in:
parent
4d247ad7d3
commit
a79059d42d
@ -876,6 +876,10 @@ impl f32 {
|
||||
/// - Positive signaling NaN
|
||||
/// - Positive quiet NaN
|
||||
///
|
||||
/// Note that this function does not always agree with the [`PartialOrd`]
|
||||
/// and [`PartialEq`] implementations of `f32`. In particular, they regard
|
||||
/// negative and positive zero as equal, while `total_cmp` doesn't.
|
||||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// #![feature(total_cmp)]
|
||||
|
@ -890,6 +890,10 @@ impl f64 {
|
||||
/// - Positive signaling NaN
|
||||
/// - Positive quiet NaN
|
||||
///
|
||||
/// Note that this function does not always agree with the [`PartialOrd`]
|
||||
/// and [`PartialEq`] implementations of `f64`. In particular, they regard
|
||||
/// negative and positive zero as equal, while `total_cmp` doesn't.
|
||||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// #![feature(total_cmp)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user