[swift-evolution] [Proposal draft] Enhanced floating-point protocols
scanon at apple.com
Fri Apr 15 11:58:26 CDT 2016
> On Apr 15, 2016, at 9:52 AM, Stephan Tolksdorf via swift-evolution <swift-evolution at swift.org> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution