(Sorry for my poor English:)
I know that I can use eval to calculate the result of a mathematical expression.
However, this is not accurate(e.g: 0.3-0.2 != 0.1). After searching, I found I can use Fraction or some other methods to calculate.
But I didn't find out how to use these methods to directly calculate a string expression. For example, Fraction('239/3289') is correct but I can't use Fraction('(239/3289+392)/(12+993)').
Is there a simple way to accurately calculate an mathematical expression?
edit: Actually I'm just wondering how to parse such a formula and return the result in Fraction instead of splitting the string and using Fraction(Fraction('239/3289') + 392, 12 + 993)...Does someone know how to do it?