You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looks like a workaround is to convert the variable names to Lowercase, so I'll go with that for now, but I'll leave this issue open as it would be good to know / document :)
You are correct that it's replacing it because of Euler's constant, and lowercasing does work around it, because the constant name is E and is case-sensitive.
If you're not going to need it, you can remove it by either deleting E from parser.consts, or replacing the consts field altogether to remove all the built-in constants (E, PI, true, and false).
Here's an example:
var parser = new Parser();
console.log(parser.parse('C+D+E+F+G/H').toString()); // ((((C + D) + 2.718281828459045) + F) + (G / H))
delete parser.consts.E; // or use "parser.consts = {};" to remove everything
console.log(parser.parse('C+D+E+F+G/H').toString()); // ((((C + D) + E) + F) + (G / H))
You're also right that this should definitely be documented :)
Hey guys. Sorry for raising a new issue for this but just searching for "E" is not very helpful :)
We have a formula:
C+D+E+F+G/H
Unfortunately
expr-eval
converts it to((((C + D) + 2.718281828459045) + F) + G) / H
I'm guessing because https://en.wikipedia.org/wiki/E_(mathematical_constant) ?
How do I stop
expr-eval
from changingE
to2.7182....
?Thanks!
The text was updated successfully, but these errors were encountered: