Evaluate a mathematical expression string and return the result.
The expression is tokenized, parsed with a recursive descent parser,
and evaluated in a single pass. Errors produce Wikidot-compatible
messages (e.g., "division by zero", "too many values in the stack").
NaN and Infinity results are treated as division-by-zero errors.
Evaluate a mathematical expression string and return the result.
The expression is tokenized, parsed with a recursive descent parser, and evaluated in a single pass. Errors produce Wikidot-compatible messages (e.g.,
"division by zero","too many values in the stack").NaN and Infinity results are treated as division-by-zero errors.