[issue3439] create a numbits() method for int and long types
STINNER Victor
report at bugs.python.org
Tue Dec 16 14:56:08 CET 2008
STINNER Victor <victor.stinner at haypocalc.com> added the comment:
x.numbits() is:
math.ceil(math.log(abs(x)) / math.log(2)) if x != 0
0 otherwise
and not 1 + math.floor(math.log(x) / math.log(2))
(16).numbits() is 4, not 5.
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3439>
_______________________________________
More information about the Python-bugs-list
mailing list