[issue27708] Roudning/Large Int representation error with multiplication and division

Ethan Glass report at bugs.python.org
Tue Aug 9 06:04:13 EDT 2016


Ethan Glass added the comment:

I actually started with a very small integer, said integer being 14. I then multiplied it by two large integers(10^100 or higher).I no longer have access to the two large integers, as they were never stored. When I divided the product by the two large integers, the quotient is returned as 13, 14, or 15.  I have done more testing and found that the correct quotient of 14 is almost always returned, but 13 or 15 are returned occasionally. I am not trying to convert anything to/from a float to/from an integer. I typed a similar equation into the python shell and found that if I only divide by one of the factors, the return is a floating point that appears something like this:
6.754791118045615e+200
This is displayed in scientific notation as a float multiplied by 10^200. I do not know if this is how the computer processes and stored the integer or just how it is displayed,but if it is in fact how the integer is stored, it would theoretically be subject to rounding errors.

----------

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


More information about the Python-bugs-list mailing list