[issue15391] Add bitlength function to the math module

2012-07-20 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Indeed, int.bit_length is the way to do this. -- nosy: +mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15391 ___

[issue15391] Add bitlength function to the math module

2012-07-18 Thread anon
New submission from anon unluckykit...@mailinator.com: Many numeric algorithms require knowing the number of bits an integer has (for instance integer squareroots). For example this simple algorithm using shifts is O(n^2): def bitl(x): x = abs(x) n = 0 while x 0: n = n+1 x = x1

[issue15391] Add bitlength function to the math module

2012-07-18 Thread Alex Gaynor
Alex Gaynor alex.gay...@gmail.com added the comment: I think what you're looking for already exists: http://docs.python.org/dev/library/stdtypes.html#int.bit_length -- nosy: +alex ___ Python tracker rep...@bugs.python.org

[issue15391] Add bitlength function to the math module

2012-07-18 Thread Jesús Cea Avión
Changes by Jesús Cea Avión j...@jcea.es: -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15391 ___ ___ Python-bugs-list mailing list

[issue15391] Add bitlength function to the math module

2012-07-18 Thread Jesús Cea Avión
Jesús Cea Avión j...@jcea.es added the comment: Closing as Invalid. I think that Alex is right. Anon, if you think this is a mistake, please reopen and argument. -- resolution: - invalid status: open - closed ___ Python tracker