Skip to content

Commit cd29d0f

Browse files
committed
[stdlib] NaN and strict total order (#2277)
Adding a note to the doc comment on Comparable protocol, saying that it only defines strict total order on normal (non-exceptional) values of conforming types.
1 parent 720167f commit cd29d0f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

stdlib/public/core/Policy.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,11 @@ public func >= <T : Comparable>(lhs: T, rhs: T) -> Bool {
225225
}
226226

227227
/// Instances of conforming types can be compared using relational
228-
/// operators, which define a [strict total order](http://en.wikipedia.org/wiki/Total_order#Strict_total_order).
228+
/// operators, which define a [strict total order](http://en.wikipedia.org/wiki/Total_order#Strict_total_order)
229+
/// on normal values. A conforming type may contain a subset of values which
230+
/// are treated as exceptional; i.e. outside the domain of meaningful arguments
231+
/// for the purposes of the Comparable protocol; such values need not take part
232+
/// in the strict total order. One example is NaN for floating-point types.
229233
///
230234
/// A type conforming to `Comparable` need only supply the `<` and
231235
/// `==` operators; default implementations of `<=`, `>`, `>=`, and

0 commit comments

Comments
 (0)