Tim Peters <t...@python.org> added the comment:

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

----------
nosy: +tim.peters
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44034>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to