jiggzson/nerdamer

Problem with simplify

szoshi opened this issue · 6 comments

Hi, I think here is a bug that needs to be looked at. I am trying to simplify two expressions which results in a sign error

For e.g.

let eq1 = nerdamer("(-3/2)x+(1/3)y+2+z")
eq1.simplify gives "-12-2
y-6
z+9*x" with a multiplier of 1/6 which is a sign error

If however, let eq1 = nerdamer("(-3/2)x+(1/3)y+z")
Then eq2.simplify gives "-9
x+2
y+6*z" also with a multiplier of 1/6 which is correct.

I had similar expressions where it worked without a problem so i could not narrow it down further.

not sure where the bug is, but
https://github.com/jiggzson/nerdamer/blob/master/nerdamer.core.js#L9290 on this line sign is set to 1 and the sign of b is ignored

@szoshi, got it.

@Yaffle, Thanks for looking into this. Gives me a place to start looking.

@szoshi, it appears this issue was fixed with one of the commits. Not sure which one but I suspect this one (5fb1b7b). I added a test for this issue.

@Yaffle, after taking a closer look at the line you mentioned, it appears that the sign eventually gets used here. I think it's being stored that early on because that information is lost after that point. Unless I'm missing something.

Hi guys, I haven't received any further updates on this issue so just wanted to check if there has been any progress? Thanks!

@szoshi, this should be fixed on the dev branch.