[swift-evolution] Besides pi, include also e as a builtin mathematical constant into floats

Erica Sadun erica at ericasadun.com
Fri Jul 1 11:05:34 CDT 2016


> On Jul 1, 2016, at 6:12 AM, Björn Forster via swift-evolution <swift-evolution at swift.org> wrote:
> 
> In SE-0067: Enhanced Floating Point Protocols <https://github.com/apple/swift-evolution/blob/master/proposals/0067-floating-point-protocols.md> is stated that pi will be a built in constant from Swift 3 onwards.
> Is there a specific reason why pi as a constant will be included but not e? e is also ubiquitous in scientific, engineering and economic calculations. I seems odd to me to include pi but then not e as well. Also Python provides both pi and e. Shouldn't Swift provide also at least both pi and e as constants for its floating point types? 
> It is also not nice if different numerical packages for swift will come up all with their own different definitions of e. I think Swift 3 should use the opportunity to get this thing right from the beginning and provided both pi AND e. 
> 
> Is there a new proposal necessary to still get e as a built in constant into Swift 3? 

I think this thread will answer that question for you:
http://thread.gmane.org/gmane.comp.lang.swift.evolution/22200/focus=22466

> This was discussed as part of SE-0067.
> 
> The consensus was that pi deserved special treatment, as it is used in general-purpose code an order of magnitude more often than the all other constants combined.  I don’t think that anyone argued against it’s inclusion.
> – Steve

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


More information about the swift-evolution mailing list