Closed KBungei closed 4 years ago
I am not able to help you improve your workaround, but I did make a Decimal.eval
method a long time ago but never published it due to the existence of math.js, which uses this library under the hood.
I may publish it soon as a decimal.js extension .
It would be convinient if there was a way to just pass a math expression as a string that contains numbers and the normal JavaScript operators and have it evaluated to a result
something like:
my not-so-perfect way around that has been to use regular expressions like this
and I have to break down inner brackets for it to work:
but sometimes it fails
a model case being "5+7(-65)"
perhaps you can help me improve my work around?