[swift-evolution] Add max/min to floating point types

Stephen Canon scanon at apple.com
Sun Jun 12 22:35:39 CDT 2016


> On Jun 10, 2016, at 5:20 PM, Darren Mo <darren.mo at me.com> wrote:
> 
>> – They’re not actually the maximum and minimum values of the type.  In particular, that `max(Float.infinity, .max)` wouldn’t be `Float.max` is pretty seriously confusing.
> 
> Infinity is a special value. I would argue that people who use infinity know exactly what they are doing and would not be thrown by Float.infinity being greater than Float.max. I am willing to bet that most regular users don’t even know that infinity can be represented since it is rarely needed in real-world usage.

For clarity, what use cases do you have in mind where the largest finite value is more appropriate than infinity?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160612/da79ff4b/attachment.html>


More information about the swift-evolution mailing list