I was looking at the Python documentation of fractions
and trying this code:
from fractions import Fraction
>>> print("Fraction (0.5):", Fraction(0.5))
Fraction (0.5): 1/2
>>> print("Fraction (0.1):", Fraction(0.1))
Fraction (0.1): 3602879701896397/36028797018963968
>>> print(1/10)
0.1
Looking at the Fraction(0.1)
result I thought it was my computer problem, but when I tried it on several computers the results were same.
My question
- is there any computational reason to choose these odd numbers
3602879701896397/36028797018963968
instead of1/10
just like1/2
as it chosen forFraction(0.5)
. - more of these exist in python?