-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More docs #4
Comments
Hey Talamaska, the "Math.PI", etc are defined in lib/Constants.js -- those should just work out of the box. The list supported is: ['E', 'LN2', 'LN10', 'LOG2E', 'LOG10E', 'PI', 'SQRT1_2', 'SQRT2'] For the variables, you'll want to look into overriding the lib/Variables.js class (in particular, the "load" and "save" methods) so that you can store them wherever you wish. I would recommend something like Redis as a quick&dirty in-memory storage solution that should perform well for you. The way it was currently designed, the variables are intended to be "shared" (this was used in an IRC bot, so multiple users in the same channel would have the same value for "x"). If you want the variables to be user-specific for your website, you're going to need to add some additional plumbing to your customizations so that you can pass a user identifier along with the variables to get/set/save/load. |
Yea, per-instance is not a bad idea. It was never intended to be used as Definitely agree on semantic versioning. Shaun On Tue, Feb 18, 2014 at 12:09 AM, Konrad Borowski
|
Hello, I'm very interested into using this library for parsing custom math expressions.
I'm planning to have Web ui for creating those, and save them into my database.
the question that bothers me is about the variables. I guess I could save them separately and input them into the evaluate with .set('x',3).
Then if I have expression x**2-PI which result in calculation Math.pow(3,2)-Math.PI.
I'm not quite sure how to set PI or E in the expression string.
The text was updated successfully, but these errors were encountered: