[issue8860] Rounding in timedelta constructor is inconsistent with that in timedelta arithmetics

Alexander Belopolsky report at bugs.python.org
Thu Jun 24 23:18:07 CEST 2010


Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:

Similar problem affects fromtimestamp() constructors:

>>> datetime.fromtimestamp(0.0078125)-datetime.fromtimestamp(0)
datetime.timedelta(0, 0, 7813)
>>> datetime.utcfromtimestamp(0.0078125)-datetime.utcfromtimestamp(0)
datetime.timedelta(0, 0, 7813)

both rounded to odd, but

>>> 0.0078125*timedelta(seconds=1)
datetime.timedelta(0, 0, 7812)

is correctly rounded to even.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8860>
_______________________________________


More information about the Python-bugs-list mailing list