[New-bugs-announce] [issue46525] datetime.timestamp() lose precision when the time is too large

Yilei Yang report at bugs.python.org
Tue Jan 25 16:33:20 EST 2022


New submission from Yilei Yang <yileiyang9 at gmail.com>:

Examples:

>>> datetime.datetime(2222, 1, 1, microsecond=999999).timestamp()
7952371200.999999
>>> datetime.datetime(3333, 1, 1, microsecond=999999).timestamp()
43012195201.0
>>> datetime.datetime(2567, 1, 1, microsecond=999998).timestamp()
18839548800.999996

I believe this is an issue caused by using `double` in the C implementation.

----------
components: Library (Lib)
messages: 411676
nosy: yilei
priority: normal
severity: normal
status: open
title: datetime.timestamp() lose precision when the time is too large
type: behavior
versions: Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46525>
_______________________________________


More information about the New-bugs-announce mailing list