Log base 2 of large integers
Skip Montanaro
skip at pobox.com
Wed Aug 13 09:16:40 EDT 2014
On Wed, Aug 13, 2014 at 8:05 AM, Mok-Kong Shen
<mok-kong.shen at t-online.de> wrote:
> I like to compute log base 2 of a fairly large integer n but
> with math.log(n,2) I got:
>
> OverflowError: long int too large to convert to float.
>
> Is there any feasible work-around for that?
A bit of googling turned up this page:
http://gnumbers.blogspot.com/2011/10/logarithm-of-large-number-it-is-not.html
Might be worth studying for ideas.
Skip
More information about the Python-list
mailing list