Question about slight deviations when using integer division with large integers.

Christian Seberino cseberino at
Sun Dec 30 21:49:23 EST 2018

Why are the following two similar prints slightly different and how fix?

>>> x = 0x739ad43ed636

>>> print(x + (-x) // 2048)

>>> print(x - x // 2048)

I'm working in an area where such deviations matter.  It would nice to understand what is happening.  

Any help greatly appreciated.


More information about the Python-list mailing list