$ cat demo.py from fractions import Fraction; print (Fraction(1, 10) == 0.1); # False print (Fraction(3602879701896397, 36028797018963968) == 0.1); # True $ python3 demo.py False True