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

David Waite david at alkaline-solutions.com
Fri Jul 1 13:33:21 CDT 2016


> On Jul 1, 2016, at 10:05 AM, Erica Sadun via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> 
> 
>> On Jul 1, 2016, at 6:12 AM, Björn Forster via swift-evolution <swift-evolution at swift.org <mailto: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 <http://thread.gmane.org/gmane.comp.lang.swift.evolution/22200/focus=22466>
That only is about tau, which is a much more controversial operator. Unfortunately, I wasn’t able to find the discussion of pi or E in the archives (but neither pi nor e are very searchable)

In general, the line for mathematical functions appears to have been set pretty high for inclusion in SE-0067, focusing instead on IEEE 754 capabilities and general design/naming. There are a number of features missing from a standard math library such as the ability to do trigonometric and hyperbolic operations, exponential and logarithmic operations, and so on. I am not sure what criteria determined where this line was drawn. I suspect it was trying to get to a point of just additive changes.

But for all I know, pi may have been included just so that people didn’t use π in math extension libraries ;-)

-DW

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160701/76a45cf7/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 496 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160701/76a45cf7/attachment.sig>


More information about the swift-evolution mailing list