axiacore / py-expression-eval

MIT License
149 stars 54 forks source link

certain expressions make it crash #75

Open folkertvanheusden opened 2 years ago

folkertvanheusden commented 2 years ago

e.g.:

2 ^ 999999999999999999999999999999999999

yd4011439 commented 1 year ago

There is a one quick fix for this but will always return float as output for '^' operator.

import math
from py_expression_eval import Parser
parser = Parser()
parser.ops2['**'] = math.pow
parser.ops2['^'] = math.pow
parser.parse("2^99999999").evaluate({})

# This will cause
OverflowError: math range error