Martin Panter <vadmium...@gmail.com> added the comment:

I find the model in terms of “bit_length” hard to understand. You have to 
understand what bit_length returns, and why you added 1. Bit_length is awkward 
for negative numbers. It only uses the absolute value, which would give 
off-by-one problems with negative values, so I guess you added 1 to compensate.

I understand the bitwise operations as using two’s complement extended to an 
unlimited width, so that negative values have a series of ones for the 
most-significant bits. I presume this is what your “2-adic representation” is. 
Having this spelled out may have helped when I was learning Python.

----------
nosy: +martin.panter

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

Reply via email to