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

Christian Seberino cseberino at gmail.com
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)
127046758190683

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

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

Any help greatly appreciated.

cs



More information about the Python-list mailing list