Skip to content
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

How to add "-" as unary operator with lower precedence than "^" #40

Open
karenpb opened this issue Mar 31, 2016 · 0 comments
Open

How to add "-" as unary operator with lower precedence than "^" #40

karenpb opened this issue Mar 31, 2016 · 0 comments

Comments

@karenpb
Copy link

karenpb commented Mar 31, 2016

Hi,

I am running into the issue that when interpret the expression "2^-1^2^3", the returned expression tree takes precedence as ((2^(-1))^2)^3. But the expectation is 2^(-((1^2)^3)). I realize that in this case the unary operator "-" takes higher precedence than "^".

Is there any way that I can assign "-" with precedence lower than "^"?

I have tried to call jsep.addUnaryOp('-'); but it doesn't seem to change the default precedence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant