[swift-evolution] [Draft][Proposal] Formalized Ordering
scanon at apple.com
Fri Jul 22 23:34:12 CDT 2016
> The point of this design is that `===` means identity and that `.same `
> also means identity.
> Since this is new territory I suppose we get to decide what identity
> means for floating point. Should +0 and -0 have the same identity or
> not? I’ll leave the answer to folks more knowledgable about numerics
> than I.
Boy, I take my wife out for a movie and come back to 50 new messages on SE.
I need to read the entire thread more carefully, but off the top of my head, I think that `-0 === +0` is False. If we’re going to have an `isSame` / `isIdentical` / whatever it's called, I would expect it to imply substitutability. Although -0 == +0, they are not equivalent when substituted:
- 1/(-0) != 1/0
- Float(-0).sign != Float(+0).sign
This probably then implies that `<=>` is not `.same` either. I’ll read the rest of this and respond more completely tomorrow.
More information about the swift-evolution