bijington/expressive

Pi

Closed this issue · 7 comments

Are there plans to implement a constant for pi?

Personally not that I can think of. I asked about pi because when I showed a demo the first thing tried was "pi * Pow(2,2)" and I thought it might be useful if the lib to have it predefined.

How many of these you want to support would be entirely up to you: https://en.wikipedia.org/wiki/Mathematical_constant

My only other feedback is if you might consider ^ as an expression for power, e.g. 2^2 in addition to Pow(2,2).

Thanks, I will go through that list a bit more thoroughly and see what makes sense to include. I think for the time being it will probably involve a minimal set of constants but I will expose a mechanism for users to register their own constants making it fairly extensible.

On the point about the ^ symbol, unfortunately because this framework does more than just mathematical operations that symbol has another purpose. It currently operates as a Bitwise Exclusive Or (https://docs.microsoft.com/en-us/cpp/cpp/bitwise-exclusive-or-operator-hat?view=vs-2017)

Slipped back out of this release but will hopefully be achievable in the next release

The plan for constants at least for the short term will be to expose them as parameterless functions much like Excel does e.g.

PI() will return the Pi constant.

Solved by PR #92 PI() and E() are now available as constant functions.

Fixed and shipped in release v2.3.0