Steven D'Aprano added the comment:

Your description is hard to understand, and doesn't give enough detail, but I 
*think* I can guess what you might be referring to.

If you start with a really big integer, and divide, you get a float. But really 
big floats cannot represent every number exactly (they only have a limited 
precision). For example:

py> n = 12345678901234567
py> print(n, n/1)
12345678901234567 1.2345678901234568e+16

Converting n to an int (you don't need to use division, calling float() will do 
the same thing) rounds to the nearest possible 64-bit floating point value, 
which happens to be one larger.

If this is the error you are talking about, there's nothing that can be done 
about it. It is fundamental to the way floating point numbers work.

If you mean something different, please explain.

----------
nosy: +steven.daprano

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

Reply via email to