This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients CuriousLearner, docs@python, mark.dickinson, martin.panter, ncoghlan, tim.peters, wolma
Date 2017-11-06.02:58:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1509937115.24.0.213398074469.issue29710@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-11-06 02:58:35martin.pantersetrecipients: + martin.panter, tim.peters, mark.dickinson, ncoghlan, docs@python, wolma, CuriousLearner
2017-11-06 02:58:35martin.pantersetmessageid: <1509937115.24.0.213398074469.issue29710@psf.upfronthosting.co.za>
2017-11-06 02:58:35martin.panterlinkissue29710 messages
2017-11-06 02:58:34martin.pantercreate