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?
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?
On Jul 1, 2016, at 6:12 AM, Björn Forster via swift-evolution <swift-evolution@swift.org> wrote:
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
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
···
On Jul 1, 2016, at 10:05 AM, Erica Sadun via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:
On Jul 1, 2016, at 6:12 AM, Björn Forster via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@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?
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.
That’s exactly right.
I expect that math functions and constants will eventually make up a math protocol, separate from FloatingPoint. For the short-term, that niche is filled by the C standard library. `pi` is so frequently used that we made an exception for it.
– Steve
···
On Jul 1, 2016, at 2:33 PM, David Waite via swift-evolution <swift-evolution@swift.org> wrote: