[swift-evolution] [Review #2] SE-0067: Enhanced Floating Point Protocols

Xiaodi Wu xiaodi.wu at gmail.com
Mon Apr 25 19:45:47 CDT 2016


>
>         * What is your evaluation of the proposal?
>

Improved.

Suggestions re naming of `isLessThanOrEqualTo(_:)`:
"Less-than" can be regarded as a unit. Thus, `isLessThan(_:)` is
reasonable. However, `isEqualTo(_:)` is kind of a stretch, but it could
just be `equals(_:)`. Thus, you could have:
```
equals(_:)
isLessThan(_:)
isLessThanOrEquals(_:)
isGreaterThan(_:)
isGreaterThanOrEquals(_:)
isTotallyOrdered(below:)
```

Typos in comments (not exhaustive):
* Above `init(signOf:magnitudeOf:)`, comment should read "...exponent and
significand are taken from `magnitudeOf`" instead of "...taken from
`magnitude`"
* Above `isTotallyOrdered(below:)`, "preceeds" [sic] should be "precedes"

Other thoughts:
* I finally see why IEEE 754 calls it "minNum"--namely, "Num" implies
strongly how NaNs are handled. (What's the minimum of 0 and NaN? I dunno,
they're unordered. What's the minimum *number* given 0 and NaN? Well, it
has to be 0, because NaN isn't a number.) I wonder if this is a useful
thing to include in the Swift name (i.e. `minimumNumber`)
* Still not sure about ulpOfOne; if the point is to encourage people who
incorrectly reach for DBL_EPSILON to understand what's going on, then by
the time they learn what ULP is they should know that `(1.0).ulp ==
Double.ulpOfOne`

        * Is the problem being addressed significant enough to warrant a
> change to Swift?
>

Yes, as mentioned previously.


>         * Does this proposal fit well with the feel and direction of Swift?
>

Yes, fits much better with these revisions.


>         * If you have you used other languages or libraries with a similar
> feature, how do you feel that this proposal compares to those?
>

Compares favorably.


>         * How much effort did you put into your review? A glance, a quick
> reading, or an in-depth study?
>

Quick reading of revised proposal; in-depth study of earlier iterations.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160425/f374448f/attachment.html>


More information about the swift-evolution mailing list