axiacore / py-expression-eval

MIT License
149 stars 54 forks source link

toString() it's not working with negative numbers #27

Open magdy-zon opened 7 years ago

magdy-zon commented 7 years ago

Hi my friend!

I was working perfectly with your library until I had a trouble with a simple example: When I was trying to parse '-1' I do:

>>> parser.parse('-1').toString()

Shows an error: Traceback (most recent call last): File "", line 1, in File "/Library/Python/2.7/site-packages/py_expression_eval/init.py", line 185, in toString nstack.append('(' + f + n1 + ')') TypeError: cannot concatenate 'str' and 'float' objects

Thanks for read my issue and have good code lines.

flotwig commented 6 years ago

A similar issue happens when you try to use toString() on an expression that uses functions, it says that TypeError: must be str, not float on line 187.