jiggzson / nerdamer

a symbolic math expression evaluator for javascript
http://www.nerdamer.com
MIT License
517 stars 82 forks source link

Simplify giving wrong answer on ratio of quadratics. #566

Closed thunderkid closed 3 years ago

thunderkid commented 4 years ago

The expression

simplify((-2 x -2 x^2 - 2)/(x + x^2 + 1))

gives 2 instead of the correct answer of -2.

Note that this is different than https://github.com/jiggzson/nerdamer/issues/565. In that case, simplify failed to do anything at all (though a simplification was easily possible.) In this case it does do something, but what it does is incorrect. I can't tell yet from the code whether the underlying reason for these two issues is the same, but this one is clearly more serious.