JavaScript provides 8 mathematical constants that can be accessed with the Math object. MathLN2 returns the natural logarithm of 2. If you want to override operator precedence you can put parentheses round the parts that you want to be explicitly dealt with first.
MathPI returns PI.
To have a simple DSL of mathematical expressions sandboxed from page context. 23 Mar 2016 Pavel Ivashkov. 2 pi r You could use this to let a user type math expressions into an input. You can also add subtraction multiply and divide and complete any arithmetic you need.