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 jcea, mark.dickinson, rhettinger
Date 2011-04-21.08:46:02
SpamBayes Score 6.502933e-08
Marked as misclassified No
Message-id <1303375562.98.0.283914305209.issue11888@psf.upfronthosting.co.za>
In-reply-to
Content
See also issue 3724.

I'm -0 on this:  between log(x, 2) and int.bit_length, there's not much need for log2.  log(x, 2) should be plenty accurate enough for most numerical needs;  the exception is when you're taking log base 2 of an integer and need a guarantee of exact results for powers of 2, and int.bit_length generally solves that problem.

The main issue is that we'd have to provide (and maintain) our own implementation of log2 for Windows (and other OSs that don't have all the C99 support.  Solaris?)  That implementation should, ideally:

 - provide exact values for powers of 2, and
 - be monotonic.

and that's not trivial.  As Raymond points out, on x86 / x64 we might be able to use inline assembly directly;  that would probably cover us for Windows.
History
Date User Action Args
2011-04-21 08:46:03mark.dickinsonsetrecipients: + mark.dickinson, rhettinger, jcea
2011-04-21 08:46:02mark.dickinsonsetmessageid: <1303375562.98.0.283914305209.issue11888@psf.upfronthosting.co.za>
2011-04-21 08:46:02mark.dickinsonlinkissue11888 messages
2011-04-21 08:46:02mark.dickinsoncreate