why the inconsistency?

Richard Brodie R.Brodie at rl.ac.uk
Fri Sep 26 15:10:01 CEST 2003


"Alex Martelli" <aleax at aleax.it> wrote in message news:CxWcb.172171$R32.5498673 at news2.tin.it...

> I'm not sure how you'd compute log on integer numbers.  Anyway,
> if you're in a hurry to know the number of digits in 2**64 -- I
> see math.log(x,10) taking about 4 usec per loop, len(str(x)) about
> 6.3, in each case with x=2*64 and measuring with timeit.py
> (elapsed time, as I'm measuring on Linux).

And if you're really in a hurry 64 * log10(2) is good too ;)






More information about the Python-list mailing list