Message361308
I compare nanoseconds (int):
>>> t=1580301619906185300
# int/int: int.__truediv__(int)
>>> abs(t - int(t/10**9 * 1e9))
172
# int/float: float.__rtruediv__(int)
>>> abs(t - int(t/1e9 * 1e9))
84
# float/int: float.__truediv__(int)
>>> abs(t - int(float(t)/10**9 * 1e9))
84
# float/float: float.__truediv__(float)
>>> abs(t - int(float(t)/1e9 * 1e9))
84
=> int/int is less accurate than float/float for t=1580301619906185300
You compare seconds (float/Fraction):
>>> from fractions import Fraction as F
>>> t=1580301619906185300
# int / int
>>> float(F(t/10**9) * 10**9 - t)
88.5650634765625
# int / float
>>> float(F(t/1e9) * 10**9 - t)
-149.853515625
=> here int/int looks more accurate than int/float
And we get different conclusion :-) |
|
Date |
User |
Action |
Args |
2020-02-03 16:35:12 | vstinner | set | recipients:
+ vstinner, lemburg, rhettinger, mark.dickinson, larry, stutzbach, serhiy.storchaka, vxgmichel |
2020-02-03 16:35:11 | vstinner | set | messageid: <1580747712.0.0.1275697553.issue39484@roundup.psfhosted.org> |
2020-02-03 16:35:11 | vstinner | link | issue39484 messages |
2020-02-03 16:35:11 | vstinner | create | |
|