This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vxgmichel
Recipients larry, lemburg, mark.dickinson, rhettinger, serhiy.storchaka, stutzbach, vstinner, vxgmichel
Date 2020-02-03.18:40:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> To be clear: the following is flawed as an accuracy test, because the *multiplication* by 1e9 introduces additional error.

Interesting, I completely missed that! 

But did you notice that the full conversion might still perform better when using only floats?

>>> from fractions import Fraction as F                                                   
>>> r = 1580301619906185300                                                              
>>> abs(int(r / 1e9 * 1e9) - r)                                                          
>>> abs(round(F(r / 10**9) * 10**9) - r)                                               

I wanted to figure out how often that happens so I updated my plotting, you can find the code and plot attached.

Notice how both methods seems to perform equally good (the difference of the absolute errors seems to average to zero). I have no idea about why that happens though.
Date User Action Args
2020-02-03 18:40:47vxgmichelsetrecipients: + vxgmichel, lemburg, rhettinger, mark.dickinson, vstinner, larry, stutzbach, serhiy.storchaka
2020-02-03 18:40:47vxgmichelsetmessageid: <>
2020-02-03 18:40:47vxgmichellinkissue39484 messages
2020-02-03 18:40:47vxgmichelcreate