Problem with timeit

ast nomail at com.invalid
Fri Dec 15 08:25:55 EST 2017


"Thomas Jollans" <tjol at tjol.eu> a écrit dans le message de 
news:mailman.74.1513341235.14074.python-list at python.org...
> On 2017-12-15 11:36, ast wrote:


> No, this is right. The calculation takes practically no time; on my
> system, it takes some 10 ns. The uncertainty of the timeit result is at
> least a few hundred nanoseconds.

There are more than 100000 multiplications to perform on a
soaring size integer. I have some doubts "x=123456**123456 "
only takes 10 ns on your system.

On my computer it takes roughtly 4 s, mesured with a watch.
I can't do "len(str(x))" to know the size, I have to kill the process
But x.bit_length() answers 2088091, so x should have about
600000 digits

If I measure execution time:

>>> t=time(); x=123456**123456; print(time()-t)
0.0

There is still something wrong

I suppose that my computer CPU goes to 100% busy and
that the timer used by timeit or time no longer works.









More information about the Python-list mailing list