Calculate Big Number
casevh at gmail.com
casevh at gmail.com
Tue Jan 8 11:33:03 EST 2013
On Tuesday, January 8, 2013 2:06:09 AM UTC-8, Gisle Vanem wrote:
> "Steven D'Aprano" <email deleted> 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=100000))
> > 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 python-binding like
> gmpy? http://code.google.com/p/gmpy/wiki/IntroductionToGmpy
>
> GMP can include optimized assembler for the CPU you're using. But
> I guess it needs more memory. Hence disk-swapping could be an issue
> on performance.
>
gmpy will be faster than Python as the numbers get larger. The cutover varies depending on the platform, but usually occurs between 50 and 100 digits.
casevh
>
> --gv
More information about the Python-list
mailing list