[swift-evolution] [Draft][Proposal] Formalized Ordering

Dmitri Gribenko gribozavr at gmail.com
Fri Jul 22 10:31:36 CDT 2016

On Fri, Jul 22, 2016 at 2:13 AM, Pyry Jahkola via swift-evolution
<swift-evolution at swift.org> wrote:
> 5. Will it be considered "ok" to define a type for which `T.areSame(a, b) == true` but `a != b`? An obvious example would be Double.nan, so I assume the answer is a resounding yes.

Yes, because `==` is not a protocol requirement of Equatable, so it
can have domain-specific semantics.

> 6. Similarly, will it be "ok" to define a type for which `T.areSame(a, b) == false` but `a == b`? One possible example could be the comparison of `-0.0 <=> +0.0`. Should those be `.same` or not?
> 7. What, in fact, is the proposed total order for the stdlib's floating-point types?

The IEEE 754 definition.



(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/

More information about the swift-evolution mailing list