Message305616
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. |
|
Date |
User |
Action |
Args |
2017-11-06 02:58:35 | martin.panter | set | recipients:
+ martin.panter, tim.peters, mark.dickinson, ncoghlan, docs@python, wolma, CuriousLearner |
2017-11-06 02:58:35 | martin.panter | set | messageid: <1509937115.24.0.213398074469.issue29710@psf.upfronthosting.co.za> |
2017-11-06 02:58:35 | martin.panter | link | issue29710 messages |
2017-11-06 02:58:34 | martin.panter | create | |
|