[Tutor] Fraction - differing interpretations for number and string
Jim Mooney
cybervigilante at gmail.com
Thu Apr 16 07:03:59 CEST 2015
Why does Fraction interpret a number and string so differently? They come
out the same, but it seems rather odd
>>> from fractions import Fraction
>>> Fraction(1.64)
Fraction(7385903388887613, 4503599627370496)
>>> Fraction("1.64")
Fraction(41, 25)
>>> 41/25
1.64
>>> 7385903388887613 / 4503599627370496
1.64
--
Jim
"Greetings, Windows user. Your installation of Linux has been blocked. You
are our bitch forever, HaHaHaHaHa!" --signed, your friends at Microsoft
More information about the Tutor
mailing list