@@ -1008,29 +1008,37 @@ impl f32 {
1008
1008
Self :: from_bits ( u32:: from_ne_bytes ( bytes) )
1009
1009
}
1010
1010
1011
- /// Returns an ordering between self and other values.
1011
+ /// Return the ordering between `self` and `other`.
1012
+ ///
1012
1013
/// Unlike the standard partial comparison between floating point numbers,
1013
1014
/// this comparison always produces an ordering in accordance to
1014
- /// the totalOrder predicate as defined in IEEE 754 (2008 revision)
1015
- /// floating point standard. The values are ordered in following order:
1016
- /// - Negative quiet NaN
1017
- /// - Negative signaling NaN
1018
- /// - Negative infinity
1019
- /// - Negative numbers
1020
- /// - Negative subnormal numbers
1021
- /// - Negative zero
1022
- /// - Positive zero
1023
- /// - Positive subnormal numbers
1024
- /// - Positive numbers
1025
- /// - Positive infinity
1026
- /// - Positive signaling NaN
1027
- /// - Positive quiet NaN
1028
- ///
1029
- /// Note that this function does not always agree with the [`PartialOrd`]
1030
- /// and [`PartialEq`] implementations of `f32`. In particular, they regard
1031
- /// negative and positive zero as equal, while `total_cmp` doesn't.
1015
+ /// the `totalOrder` predicate as defined in the IEEE 754 (2008 revision)
1016
+ /// floating point standard. The values are ordered in the following sequence:
1017
+ ///
1018
+ /// - negative quiet NaN
1019
+ /// - negative signaling NaN
1020
+ /// - negative infinity
1021
+ /// - negative numbers
1022
+ /// - negative subnormal numbers
1023
+ /// - negative zero
1024
+ /// - positive zero
1025
+ /// - positive subnormal numbers
1026
+ /// - positive numbers
1027
+ /// - positive infinity
1028
+ /// - positive signaling NaN
1029
+ /// - positive quiet NaN.
1030
+ ///
1031
+ /// The ordering established by this function does not always agree with the
1032
+ /// [`PartialOrd`] and [`PartialEq`] implementations of `f32`. For example,
1033
+ /// they consider negative and positive zero equal, while `total_cmp`
1034
+ /// doesn't.
1035
+ ///
1036
+ /// The interpretation of the signaling NaN bit follows the definition in
1037
+ /// the IEEE 754 standard, which may not match the interpretation by some of
1038
+ /// the older, non-conformant (e.g. MIPS) hardware implementations.
1032
1039
///
1033
1040
/// # Example
1041
+ ///
1034
1042
/// ```
1035
1043
/// #![feature(total_cmp)]
1036
1044
/// struct GoodBoy {
0 commit comments