cortex-js / compute-engine

An engine for symbolic manipulation and numeric evaluation of math formulas expressed with MathJSON
https://cortexjs.io
MIT License
356 stars 42 forks source link

Negative mixed fractions parsing is faulty. #164

Closed truebluepl closed 4 months ago

truebluepl commented 4 months ago

Description

Negative mixed fractions parsing is faulty.

Steps to Reproduce

const ce = new ComputeEngine.ComputeEngine();
let a = ce.parse('-1\\frac{2}{3}');
console.log(a.value);

Actual Behavior

Returns -0.3333333333333333, which means value is parsed as -1+2/3, not as -1-(2/3)

Expected Behavior

Should returns -1.6666666666666667