Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

To what extent is it precise to evaluate Sympy enormous fractions (Rational)?

I am using Sympy Rational in an algorithm and I am getting enormous factions. Numerator and Denominator grow up to 10000 digits.

I would like to stop the algorithm as soon as the fractions become unevaluable. So the question is, what is the maximum magnitude I can allow for sympy.Rational?

like image 633
D1X Avatar asked Dec 13 '25 14:12

D1X


1 Answers

The size of SymPy Rationals is limited only by your available memory. If you want an approximate but memory bounded number, use a Float. You can convert a Rational into a Float with evalf.

like image 61
asmeurer Avatar answered Dec 15 '25 10:12

asmeurer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!