[swift-evolution] [Proposal] Add floor() and ceiling() functions to FloatingPoint
David Sweeris
davesweeris at mac.com
Mon Jun 27 14:01:12 CDT 2016
I'm starting to come down from me earlier +1... Floor and ceiling are more functions than properties of a number, aren't they?
- Dave Sweeris
> On Jun 25, 2016, at 11:48, David Sweeris via swift-evolution <swift-evolution at swift.org> wrote:
>
> +1
>
> The only thing I'm worried about is the situation where we have "x = N.M", and `x.ceiling` equals maybe "(N+2).0" instead of "(N+1).0" because we ran out of precision and can't represent (N+1).0. I'm not sure what the exact values are where floats (or doubles) stop having enough precision to represent inter-integer values... It might be a moot point.
>
> I'd suggest the functions' descriptions to be changed from "[largest|smallest] integral value" to "[largest|smallest] representable integral value".
>
> - Dave Sweeris
More information about the swift-evolution
mailing list