Message134197
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. |
|
Date |
User |
Action |
Args |
2011-04-21 08:46:03 | mark.dickinson | set | recipients:
+ mark.dickinson, rhettinger, jcea |
2011-04-21 08:46:02 | mark.dickinson | set | messageid: <1303375562.98.0.283914305209.issue11888@psf.upfronthosting.co.za> |
2011-04-21 08:46:02 | mark.dickinson | link | issue11888 messages |
2011-04-21 08:46:02 | mark.dickinson | create | |
|