[issue23517] datetime.utcfromtimestamp rounds results incorrectly
Tim Peters
report at bugs.python.org
Sat Sep 5 04:28:11 CEST 2015
Tim Peters added the comment:
Bah. It doesn't matter who's consuming the rounding of a binary float to decimal microseconds: there are only 32 possible fractional parts where nearest/even and half-up deliver different results. half-up preserves properties of these specific inputs that nearest/even destroys. These inputs themselves have no bias - they're utterly uniformly spaced.
Not only does nearest/even _introduce_ bias on these inputs by destroying these properties, it doesn't even preserve the spacing between them. Half-up leaves them all 5 microseconds apart, while nearest/even creates a bizarre "sometimes 4 microseconds apart, sometimes 6" output spacing out of thin air.
So it's not a question of "when in doubt" to me, it's a question of "live up to what the docs already say". Although, again, it doesn't make a lick of real difference. That's why we'll never stop arguing about it ;-)
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23517>
_______________________________________
More information about the Python-bugs-list
mailing list