[swift-evolution] [Proposal draft] Enhanced floating-point protocols
erica at ericasadun.com
Fri Apr 15 13:15:10 CDT 2016
On Apr 15: 2016: at 11:56 AM: Joe Groff via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> On Apr 15: 2016: at 8:20 AM: Stephen Canon via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> “e” is a great bike-shedding example. While it would definitely allow a fluent style if you know what you’re looking at: I worry a little bit about readability of `Float.e` or `.e` in source. Most programmers are at least passingly familiar with pi: but that familiarity doesn’t necessarily extend to e. IDEs and docstrings make this palatable: of course.
> It's also questionable to me how often `e` itself is interesting independent of an exp() or log() operation.
I'm sure it gets used but I'd imagine it would be at an order of magnitude or more less than PI. Quick gist count:
That said, I use M_PI_4 a lot because it's really handy for sample code. I'm one of the
outlier users whose use is not reflective of this quick check.
* With M_PI at 2,231 and M_E at 109, I think you can conclude that some constants really are used more
often than others.
* As my personal case reflects, less popular constants are sometimes heavily used in niche cases
Finally, it's Swift. Isn't it time for π and 𝜏 as well as Pi and Tau?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution