Skip to content

Bad multiply-division parsing #6

@sytabaresa

Description

@sytabaresa

Hi, nice library. lightweight and so useful.

But trying to make a app, I note that some expressions are not parsed correctly:

Complex.compile('1/a*b*c',['a','b','c'])

returns a optimized function in the browser:

ƒ: anonymous(Complex,a,b,c) {
return this[0].divide(a.multiply(b)).multiply(c)
}

and

Complex.compile('(1/a)*b*c',['a','b','c'])

returns

ƒ: anonymous(Complex,a,b,c) {
return this[0].divide(a).multiply(b).multiply(c)
}

that are different expressions.

* and / operators should be the same precedence and the correct result is the last (a chain of operators without grouping).

Thanks

complex-js version: 5.0.0

Metadata

Metadata

Labels

bugUnintended behavior resulting from a logical error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions