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 tim.peters
Recipients hbutt4319, paul.moore, steve.dower, tim.golden, tim.peters, zach.ware
Date 2021-05-04.17:36:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1620149765.06.0.537151622403.issue44034@roundup.psfhosted.org>
In-reply-to
Content
Please study the docs first:

https://docs.python.org/3/tutorial/floatingpoint.html

That will give you the background to understand why `int()` has nothing to do with this.

>>> 1.9999999999999999
2.0

That is, `int()` was passed 2.0 to begin with, because the binary float closest to the decimal value 1.9999999999999999 is in fact 2.0.

If you can't live with that, use the `decimal` module instead:

>>> import decimal
>>> int(decimal.Decimal("1.9999999999999999"))
1
History
Date User Action Args
2021-05-04 17:36:05tim.peterssetrecipients: + tim.peters, paul.moore, tim.golden, zach.ware, steve.dower, hbutt4319
2021-05-04 17:36:05tim.peterssetmessageid: <1620149765.06.0.537151622403.issue44034@roundup.psfhosted.org>
2021-05-04 17:36:05tim.peterslinkissue44034 messages
2021-05-04 17:36:05tim.peterscreate