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 mark.dickinson
Recipients fredrikj, loewis, mark.dickinson, rhettinger, terry.reedy, vstinner
Date 2008-12-13.09:26:11
SpamBayes Score 0.0005085584
Marked as misclassified No
Message-id <1229160432.18.0.983141755998.issue3439@psf.upfronthosting.co.za>
In-reply-to
Content
About the name:

Java's Bignum has a 'significantBits' method, which apparently returns 
the position of the MSB (i.e., numbits - 1).

GMP has mpz_sizeinbase;  mpz_sizeinbase(n, 2) is almost the same as 
numbits, except that mpz_sizeinbase(0, 2) is 1, not 0.

Mathematica has BitLength.  I quite like this.

Googling for 'ilog2' returns a good few relevant hits; again, this is 
really numbits - 1, not numbits.

How about n.bitlength?
History
Date User Action Args
2008-12-13 09:27:12mark.dickinsonsetrecipients: + mark.dickinson, loewis, rhettinger, terry.reedy, vstinner, fredrikj
2008-12-13 09:27:12mark.dickinsonsetmessageid: <1229160432.18.0.983141755998.issue3439@psf.upfronthosting.co.za>
2008-12-13 09:26:11mark.dickinsonlinkissue3439 messages
2008-12-13 09:26:11mark.dickinsoncreate