Skip to content
This repository has been archived by the owner on May 23, 2019. It is now read-only.

Double sign gets errors in algebra.parse() #88

Open
sjorsvanheuveln opened this issue Feb 24, 2018 · 4 comments
Open

Double sign gets errors in algebra.parse() #88

sjorsvanheuveln opened this issue Feb 24, 2018 · 4 comments

Comments

@sjorsvanheuveln
Copy link

sjorsvanheuveln commented Feb 24, 2018

This:
algebrea.parse('12 -- 3');

Results in an error:
SyntaxError: Missing operand

After trying some other stuff, it appears it just can't handle negative signs after the operator. E.g. this also fails:
algebra.parse('-1 * -5');

@timleland
Copy link

Any workaround for this issue?

@timrach
Copy link
Collaborator

timrach commented Mar 29, 2018

What version are you on? When I try this in the browser console at http://algebra.js.org/ it gets parsed and evaluated to "9" - which is not the correct evaluation but also not the Syntax Error you get.

Any workaround for this issue?

The workaround would be to wrap the negative number in brackets: algebra.parse('12 - (- 3)');

@sjorsvanheuveln
Copy link
Author

0.2.6

@timleland
Copy link

@timrach I wrapped them in brackets. Thanks

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

No branches or pull requests

3 participants