On Apr 15: 2016: at 11:56 AM: Joe Groff via swift-evolution 
<[email protected]> wrote:
> 
> 
>> On Apr 15: 2016: at 8:20 AM: Stephen Canon via swift-evolution 
>> <[email protected]> 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:

M_E: 109
M_LOG2E: 23
M_LOG10E: 19
M_LN2: 24
M_LN10: 10
M_PI: 2,231
M_PI_2: 255
M_PI_4: 54
M_1_PI: 27
M_2_PI: 25
M_2_SQRTPI: 23
M_SQRT2: 31
M_SQRT1_2: 26

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?

-- E

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to