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

Stephen Canon scanon at apple.com
Fri Jul 22 17:50:19 CDT 2016

> On Jul 22, 2016, at 6:34 PM, Matthew Johnson via swift-evolution <swift-evolution at swift.org> wrote:
> Sorry if it wasn’t clear.  I’m not suggesting taking that away.  I’m asking whether we have considered defining `==` on floating point types to be the equivalence relation that is proposed for `areSame` and giving the domain specific operation a different name.  
> Maybe this would break with convention too much, but it would feel much more intuitive (to me at least - although I am admittedly not a numerics expert).

IEEE754 doesn’t specify language bindings, so it *is* allowed to e.g. provide an `isEqualIEEE754` predicate and make `==` do something else.

However, doing so would break with the precedent set by … well, every mainstream programming language of the past 30 years, and make porting existing numeric code an error-prone process for anyone who hadn’t carefully studied this particular aspect of Swift.

– Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160722/cc6c74f6/attachment.html>

More information about the swift-evolution mailing list