On 2016-04-15, 18:58, Stephen Canon wrote:
but the documentation for Equatable and Comparable states that == and
< must implement an equivalence relation and a strict total order,
which is incompatible with the default IEEE-754 implementation of
these operators when NaN values are involved. How do you resolve this
conflict?
That’s a documentation bug; it should be relaxed by appending something
like “… on non-exceptional values.”
I’ll quote Dave A. to put it a bit more formally:
To be clear, the semantic conformance of floating point types to
Comparable depends on treating NaN as a "singular value”, i.e. outside
the domain of valid arguments to < /for the purposes of Comparable/.
That doesn’t mean we can’t nail down what < does for floating point
types when it does get a NaN.
Thanks for the clarification!
- Stephan
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution