最終結果を出すまで有理数で計算すれば済む話。

これじゃあかんの?

from fractions import Fraction as fr
a= fr(2,3) # 2/3
b= fr(1,7) # 1/7
print(a,b , a*b )
#2/3 1/7 2/21