3 ms·
I know that in Python, you can do: >>> import fractions >>> from fractions import Fraction as F >>> F(3, 17) * F(12, 5) + F(56, 99) Fraction(83
by BiteCode_dev 7y ago
I know that in Python, you can do:
>>> import fractions
>>> from fractions import Fraction as F
>>> F(3, 17) * F(12, 5) + F(56, 99)
Fraction(8324, 8415)
>>> F(3, 17) * F(12, 5) + F(56, 99) / 3 + 2 * 4
Fraction(217412, 25245)
However, if you use a float or a complex with it, the fraction get resolved:
>>> F(217412, 25245) + 0.1
8.712081600316894
>>> F(217412, 25245) + 1j
(8.612081600316895+1j)
You also have some constants:
>>> import math
>>> math.pi
3.141592653589793
>>> math.e
2.718281828459045
But they are not just symbol, there is a precision-limited value behind it. Although the value seems to match the precision NASA considers to be enough for trajectories of spacecrafts like Voyager: https://www.jpl.nasa.gov/edu/news/2016/3/16/how-many-decimals-of-pi-do-we-really-need/ https://www.jpl.nasa.gov/edu/news/2016/3/16/how-many-decimal...