bugwheels94 / math-expression-evaluator

Math JS library. Super advanced & efficient Math expression evaluator

Home Page:http://bugwheels94.github.io/math-expression-evaluator/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

root method not calculate with custom token

HrDelwar opened this issue · comments

I am trying to convert a number nagative to positive under root function. I register a custom token name positive who handle calculation.
my token is { type: 0, token: 'positive', show: 'positive', value: function (a) { return Math.abs(a); } }
when my formula is "positive(2-6)" is calculate fine and give me result 4.
but when my formula is "root(positive(2-6))" is not throw error but the result is NaN.

It is working AFAIK. I added test for your use case:

it('token with absolute', function () {

CICD test passed https://github.com/bugwheels94/math-expression-evaluator/runs/7197156277?check_suite_focus=true#step:5:139

Do you have other tokens added too? that might be causing some conflict

@bugwheels94 Thank you for your response. The test is passed but I don't know why it's not working in my project. But it's working in my project for extra parentheses "root(positive((2-6)))". Thank you again.