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

David Sweeris davesweeris at mac.com
Sat Jun 25 11:48:30 CDT 2016




Sent from my iPhone
> On Jun 25, 2016, at 05:06, Karl via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Proposal: https://gist.github.com/karwa/273db66cd8a5fe2c388ccc7de9c4cf31

+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 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160625/40814d27/attachment.html>


More information about the swift-evolution mailing list