Is there a way to modify eval() so that it replaces %
with /100
?
I have an app where I receive dynamic formulas that need to be evaluated. The problem arises when the formula includes %
. For example:
E_LOW%*CT_TOTAL+(1-GQC)
where E_LOW, E_TOTAL, GQC are constants.
For instance:
E_LOW = 10
I expect E_LOW% to be interpreted as 0.10, i.e., E_LOW% = 10/100 = 0.10
Currently, I am encountering the following error:
SyntaxError: Unexpected token *
Please note: The issue does not lie with *
. Even attempting eval(E_LOW%)
results in the error:
SyntaxError: Unexpected token )
It seems that eval is unable to understand or process anything after the %
.
Thank you in advance