Re: Problem with timeit

2017-12-19 Thread Steve D'Aprano
On Tue, 19 Dec 2017 02:27 am, ast wrote: > I discovered that log functions from math module > works with integers, whatever their size, there is > no conversion to float. > >> import math >> x = 123456**123456 >> math.log10(x) > 628577.7303641582 (instantaneous) > > so 628578 digits Nice! I

Re: Problem with timeit

2017-12-18 Thread ast
"Steve D'Aprano" a écrit dans le message de news:5a33d0fc$0$2087$b1db1813$d948b...@news.astraweb.com... On Sat, 16 Dec 2017 12:25 am, ast wrote: "Thomas Jollans" a écrit dans le message de news:mailman.74.1513341235.14074.python-l...@python.org... On 2017-12-15 11:36, ast wrote: p

Re: Problem with timeit

2017-12-15 Thread Bob van der Poel
I get a very short delay when doing the calculation. 1.90734863281e-06 to be precise. But, printing the result takes much longer. 4.82930707932 seconds. On Fri, Dec 15, 2017 at 6:47 AM, Paul Moore wrote: > On 15 December 2017 at 13:25, ast wrote: > > On my computer it takes roughtly 4 s, mes

Re: Problem with timeit

2017-12-15 Thread ast
"ast" a écrit dans le message de news:5a33a5aa$0$10195$426a7...@news.free.fr... Ty Peter and Steve, I would never have found that explanation myself -- https://mail.python.org/mailman/listinfo/python-list

Re: Problem with timeit

2017-12-15 Thread Paul Moore
On 15 December 2017 at 13:25, ast wrote: > On my computer it takes roughtly 4 s, mesured with a watch. Is your computer particularly old? On my PC, the time it takes to run x=123456**123456 at the Python interpreter prompt is barely noticeable. > I can't do "len(str(x))" to know the size, I have

Re: Problem with timeit

2017-12-15 Thread Steve D'Aprano
On Sat, 16 Dec 2017 12:25 am, ast wrote: > > "Thomas Jollans" a écrit dans le message de > news:mailman.74.1513341235.14074.python-l...@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. Th

Re: Problem with timeit

2017-12-15 Thread ast
"Thomas Jollans" a écrit dans le message de news:mailman.74.1513341235.14074.python-l...@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 hun

Re: Problem with timeit

2017-12-15 Thread Steve D'Aprano
On Fri, 15 Dec 2017 10:47 pm, Thomas Jollans wrote: > On 2017-12-15 11:36, ast wrote: >> Hi >> >> Time measurment with module timeit seems to work with some statements >> but not with some other statements on my computer. >> >> Python version 3.6.3 >> >> from timeit import Timer >> > Timer

Re: Problem with timeit

2017-12-15 Thread Steve D'Aprano
On Fri, 15 Dec 2017 09:36 pm, ast wrote: [...] > It's OK, with 10 more loops I get 10 more execution time. > > But with exponentiation, it's a mess > Timer("x=123456**123456").timeit(1) > 6.076191311876755e-06 Timer("x=123456**123456").timeit(10) > 3.841270313387213e-06 > > All wrong,

Re: Problem with timeit

2017-12-15 Thread Peter Otten
Thomas Jollans wrote: > On 2017-12-15 11:36, ast wrote: >> Hi >> >> Time measurment with module timeit seems to work with some statements >> but not with some other statements on my computer. >> >> Python version 3.6.3 >> >> from timeit import Timer >> > Timer("'-'.join([str(i) for i in ra

Re: Problem with timeit

2017-12-15 Thread Thomas Jollans
On 2017-12-15 11:36, ast wrote: > Hi > > Time measurment with module timeit seems to work with some statements > but not with some other statements on my computer. > > Python version 3.6.3 > > from timeit import Timer > Timer("'-'.join([str(i) for i in range(10)])").timeit(1) > 0.17927