[swift-evolution] [Proposal] Add floor() and ceiling() functions to FloatingPoint

Xiaodi Wu xiaodi.wu at gmail.com
Mon Jun 27 08:24:00 CDT 2016


Hmm, I think they'd qualify as terms of art; I don't know that rounding to
an arbitrary decimal place would be (although useful) primitive enough that
they should be added in stdlib [also, to genericize over floats and
doubles, how many decimal places could you usefully get?]; and grouping
families of methods by name has been rejected as a criterion for naming,
though obviously it's elegant where possible.
On Mon, Jun 27, 2016 at 05:59 Haravikk <swift-evolution at haravikk.me> wrote:

> On 27 Jun 2016, at 07:55, James Hillhouse <jdhillhouse4 at icloud.com> wrote:
>
>
> On Jun 27, 2016, at 1:53 AM, Xiaodi Wu via swift-evolution <
> swift-evolution at swift.org> wrote:
>
> I disagree: in English, the nouns are floor and ceiling. That's what they
> should be called.
>
>
> Completely agree.
>
>
> This is why I suggested roundedDown() and roundedUp() in place of floor()
> and ceiling(), as the latter are kind of strange terms to fit into Swift,
> they're not that explanatory to people that don't know them, and rounding
> up and down with precision greater than zero could also be useful
> operations. Plus it would group all rounding methods together.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160627/a4561232/attachment.html>


More information about the swift-evolution mailing list