[swift-evolution] [Proposal draft] Enhanced floating-point protocols

Erica Sadun erica at ericasadun.com
Fri Apr 15 00:12:56 CDT 2016

> On Apr 14, 2016, at 10:36 PM, Stephen Canon <scanon at apple.com> wrote:
> Hi Erica, thanks for the feedback.
>> On Apr 14, 2016, at 6:29 PM, Erica Sadun <erica at ericasadun.com <mailto:erica at ericasadun.com>> wrote:
>> * I do use % for floating point but not as much as I first thought before I started searching through my code after reading your e-mail. But when I do use it, it's nice to have a really familiar symbol rather than a big word. What were the ways that it was used incorrectly? Do you have some examples?
> As it happens, I have a rationale sitting around from an earlier (internal) discussion:

Thanks. That makes plenty of sense although I do still think the name is long and hard to discover compared to fmod[1] and %.

>> * I don't quite get how equatable is going to work. Do you mind explaining that in more detail?
> I’m not totally sure what your question is.  Are you asking how FloatingPoint will conform to Equatable, or how the Equatable protocol will work?

Given the many words and passionate articles about how difficult it is to perform floating point comparisons, 
for example, https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/, 
I'm just curious as to what approach you've settled on. The topic has come up on-list quite a few times.

-- E

[1] Nearly all of what I *thought* I was doing with % did turn out to be fmod (CGFloat a = fmodf(stepAngle * i, 360.0))
 so there's that
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160414/671f305e/attachment.html>

More information about the swift-evolution mailing list