@@ -1038,7 +1038,8 @@ public protocol FloatingPoint: SignedNumeric, Strideable, Hashable {
10381038 ///
10391039 /// - Parameter other: The value to compare with this value.
10401040 /// - Returns: `true` if `other` has the same value as this instance;
1041- /// otherwise, `false`.
1041+ /// otherwise, `false`. If either this value or `other` is NaN, the result
1042+ /// of this method is `false`.
10421043 func isEqual( to other: Self ) -> Bool
10431044
10441045 /// Returns a Boolean value indicating whether this instance is less than the
@@ -1068,7 +1069,9 @@ public protocol FloatingPoint: SignedNumeric, Strideable, Hashable {
10681069 /// [spec]: http://ieeexplore.ieee.org/servlet/opac?punumber=4610933
10691070 ///
10701071 /// - Parameter other: The value to compare with this value.
1071- /// - Returns: `true` if `other` is less than this value; otherwise, `false`.
1072+ /// - Returns: `true` if this value is less than `other`; otherwise, `false`.
1073+ /// If either this value or `other` is NaN, the result of this method is
1074+ /// `false`.
10721075 func isLess( than other: Self ) -> Bool
10731076
10741077 /// Returns a Boolean value indicating whether this instance is less than or
@@ -1096,33 +1099,33 @@ public protocol FloatingPoint: SignedNumeric, Strideable, Hashable {
10961099 /// [spec]: http://ieeexplore.ieee.org/servlet/opac?punumber=4610933
10971100 ///
10981101 /// - Parameter other: The value to compare with this value.
1099- /// - Returns: `true` if `other` is less than this value; otherwise, `false`.
1102+ /// - Returns: `true` if `other` is greater than this value; otherwise,
1103+ /// `false`. If either this value or `other` is NaN, the result of this
1104+ /// method is `false`.
11001105 func isLessThanOrEqualTo( _ other: Self ) -> Bool
11011106
1102- /// Returns a Boolean value indicating whether this instance should precede the
1103- /// given value in an ascending sort.
1107+ /// Returns a Boolean value indicating whether this instance should precede
1108+ /// or tie positions with the given value in an ascending sort.
11041109 ///
11051110 /// This relation is a refinement of the less-than-or-equal-to operator
11061111 /// (`<=`) that provides a total order on all values of the type, including
1107- /// noncanonical encodings, signed zeros, and NaNs. Because it is used much
1108- /// less frequently than the usual comparisons, there is no operator form of
1109- /// this relation.
1112+ /// signed zeros and NaNs.
11101113 ///
1111- /// The following example uses `isTotallyOrdered(below :)` to sort an array of
1112- /// floating-point values, including some that are NaN:
1114+ /// The following example uses `isTotallyOrdered(belowOrEqualTo :)` to sort an
1115+ /// array of floating-point values, including some that are NaN:
11131116 ///
11141117 /// var numbers = [2.5, 21.25, 3.0, .nan, -9.5]
1115- /// numbers.sort { $0 .isTotallyOrdered(below : $1 ) }
1116- /// // numbers == [-9.5, 2.5, 3.0, 21.25, nan ]
1118+ /// numbers.sort { !$1 .isTotallyOrdered(belowOrEqualTo : $0 ) }
1119+ /// // numbers == [-9.5, 2.5, 3.0, 21.25, NaN ]
11171120 ///
11181121 /// The `isTotallyOrdered(belowOrEqualTo:)` method implements the total order
11191122 /// relation as defined by the [IEEE 754 specification][spec].
11201123 ///
11211124 /// [spec]: http://ieeexplore.ieee.org/servlet/opac?punumber=4610933
11221125 ///
11231126 /// - Parameter other: A floating-point value to compare to this value.
1124- /// - Returns: `true` if this value is ordered below `other` in a total
1125- /// ordering of the floating-point type; otherwise, `false`.
1127+ /// - Returns: `true` if this value is ordered below or the same as `other`
1128+ /// in a total ordering of the floating-point type; otherwise, `false`.
11261129 func isTotallyOrdered( belowOrEqualTo other: Self ) -> Bool
11271130
11281131 /// A Boolean value indicating whether this instance is normal.
@@ -2029,30 +2032,28 @@ extension BinaryFloatingPoint {
20292032 significandBitPattern: magnitudeOf. significandBitPattern)
20302033 }
20312034
2032- /// Returns a Boolean value indicating whether this instance should precede the
2033- /// given value in an ascending sort.
2035+ /// Returns a Boolean value indicating whether this instance should precede
2036+ /// or tie positions with the given value in an ascending sort.
20342037 ///
20352038 /// This relation is a refinement of the less-than-or-equal-to operator
20362039 /// (`<=`) that provides a total order on all values of the type, including
2037- /// noncanonical encodings, signed zeros, and NaNs. Because it is used much
2038- /// less frequently than the usual comparisons, there is no operator form of
2039- /// this relation.
2040+ /// signed zeros and NaNs.
20402041 ///
2041- /// The following example uses `isTotallyOrdered(below :)` to sort an array of
2042- /// floating-point values, including some that are NaN:
2042+ /// The following example uses `isTotallyOrdered(belowOrEqualTo :)` to sort an
2043+ /// array of floating-point values, including some that are NaN:
20432044 ///
20442045 /// var numbers = [2.5, 21.25, 3.0, .nan, -9.5]
2045- /// numbers.sort { $0 .isTotallyOrdered(below : $1 ) }
2046- /// // numbers == [-9.5, 2.5, 3.0, 21.25, nan ]
2046+ /// numbers.sort { !$1 .isTotallyOrdered(belowOrEqualTo : $0 ) }
2047+ /// // numbers == [-9.5, 2.5, 3.0, 21.25, NaN ]
20472048 ///
20482049 /// The `isTotallyOrdered(belowOrEqualTo:)` method implements the total order
20492050 /// relation as defined by the [IEEE 754 specification][spec].
20502051 ///
20512052 /// [spec]: http://ieeexplore.ieee.org/servlet/opac?punumber=4610933
20522053 ///
20532054 /// - Parameter other: A floating-point value to compare to this value.
2054- /// - Returns: `true` if this value is ordered below `other` in a total
2055- /// ordering of the floating-point type; otherwise, `false`.
2055+ /// - Returns: `true` if this value is ordered below or the same as `other`
2056+ /// in a total ordering of the floating-point type; otherwise, `false`.
20562057 public func isTotallyOrdered( belowOrEqualTo other: Self ) -> Bool {
20572058 // Quick return when possible.
20582059 if self < other { return true }
0 commit comments