cortex-js / compute-engine

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

`serialize()` seems to overflow the stack given any input. #18

Closed bengolds closed 2 years ago

bengolds commented 3 years ago

Calling c.serialize gives a Maximum call stack size exceeded error for any input:

c.serialize(c.parse('8'))
c.serialize(c.parse('x'))
// etc. -- all crash

This is happening on version 0.4.2.

bengolds commented 3 years ago

Note -- this seems to work if you use LatexSyntax or the global serialize, but not ComputeEngine. ie:

import {serialize, parse, LatexSyntax, ComputeEngine} from '@cortex-js/compute-engine';

const latexSyntax = new LatexSyntax();
const computeEngine = new ComputeEngine();

serialize(parse('5+x')); //Works!
latexSyntax.serialize(latexSyntax.parse('5+x')); //Works!
computeEngine.serialize(computeEngine.parse('5+x')); //Doesn't work!
arnog commented 2 years ago

Should work now!