1

When I use the Fraction class from fractions module

from fractions import Fraction
Fraction(1.2)

gives,

Fraction(5404319552844595, 4503599627370496)

whereas,

Fraction('1.2')

gives,

Fraction(6, 5)

notice that,

5404319552844595/4503599627370496

gives 1.2 as output.

Then shouldn't both give Fraction(6, 5) as output.

apostofes
  • 2,959
  • 5
  • 16
  • 31

0 Answers0