Re: Calculate Big Number

2013-01-08 Thread casevh
On Tuesday, January 8, 2013 2:06:09 AM UTC-8, Gisle Vanem wrote: > "Steven D'Aprano" wrote: > > > py> from timeit import Timer > > py> t1 = Timer("(a**b)*(c**d)", setup="a,b,c,d = 10, 25, 2, 50") > > py> min(t1.repeat(repeat=5, number=10)) > > 0.5256571769714355 > > > > So that's about 5 mic

Re: Calculate Big Number

2013-01-08 Thread Gisle Vanem
"Steven D'Aprano" wrote: py> from timeit import Timer py> t1 = Timer("(a**b)*(c**d)", setup="a,b,c,d = 10, 25, 2, 50") py> min(t1.repeat(repeat=5, number=10)) 0.5256571769714355 So that's about 5 microseconds on my (slow) computer. That's pretty fast. So is there still a need for a GMP p

Re: Calculate Big Number

2013-01-07 Thread Dave Angel
(forwarding the private reply to the group) On 01/07/2013 09:03 PM, Nac Temha wrote: > Thanks. I using version 2.7 .I want to understand how to handling big > number. Just want to know logic. Without going into further details but I > want to learn logic of this issue. How to keep datas in pytho

Re: Calculate Big Number

2013-01-07 Thread Roy Smith
In article , Nac Temha wrote: > Thanks for reply. I wonder how quickly calculate big numbers. Can you > explain me as theoretical? Because this numbers overflow size of integer > and double. Now, that's a good question. The answer is that Python implements multiple-precision arithmetic. This

Re: Calculate Big Number

2013-01-07 Thread Dave Angel
On 01/07/2013 08:22 PM, Nac Temha wrote: > Thanks for reply. I wonder how quickly calculate big numbers. Can you > explain me as theoretical? Because this numbers overflow size of integer > and double. Please don't top-post. It makes the context totally out of order. Python automatically promotes

Re: Calculate Big Number

2013-01-07 Thread Dave Angel
On 01/07/2013 07:44 PM, Nac Temha wrote: > Hello, > How to *quickly* calculate large numbers. For example (10**25) * (2**50) > 11258999068426240L > > Since all of the terms are const, you could just use print "11258999068426240L" Or if you hav

Re: Calculate Big Number

2013-01-07 Thread Tomasz Rola
On Tue, 8 Jan 2013, Nac Temha wrote: > Hello, > How to *quickly* calculate large numbers. For example > >>> (10**25) * (2**50) > 11258999068426240L > Um, Karatsuba multiplication? http://en.wikipedia.org/wiki/Karatsuba_algorithm Or see what GMP folks are doing: http://

Re: Calculate Big Number

2013-01-07 Thread Nac Temha
Thanks for reply. I wonder how quickly calculate big numbers. Can you explain me as theoretical? Because this numbers overflow size of integer and double. On Tue, Jan 8, 2013 at 3:08 AM, Tim Chase wrote: > On 01/07/13 18:44, Nac Temha wrote: > >> How to *quickly* calculate large numbers. For exa

Re: Calculate Big Number

2013-01-07 Thread Tim Chase
On 01/07/13 18:44, Nac Temha wrote: How to *quickly* calculate large numbers. For example (10**25) * (2**50) 11258999068426240L that's how...just do the math. For any other sort of answer, you'd have to clarify your question. On my laptop, that operation came back

Re: Calculate Big Number

2013-01-07 Thread Oscar Benjamin
On 8 January 2013 00:44, Nac Temha wrote: > Hello, > How to quickly calculate large numbers. For example (10**25) * (2**50) > 11258999068426240L I just tested that line in the interpreter and it ran so quickly it seemed instantaneous (maybe my computer is faster than

Calculate Big Number

2013-01-07 Thread Nac Temha
Hello, How to *quickly* calculate large numbers. For example >>> (10**25) * (2**50) 11258999068426240L Regards. -- http://mail.python.org/mailman/listinfo/python-list