Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #36440

Re: Calculate Big Number

Newsgroups comp.lang.python
Date 2013-01-08 08:33 -0800
References <mailman.244.1357605853.2939.python-list@python.org> <50ebb3c1$0$30003$c3e8da3$5496439d@news.astraweb.com> <mailman.269.1357639597.2939.python-list@python.org>
Subject Re: Calculate Big Number
From casevh@gmail.com
Message-ID <mailman.282.1357662793.2939.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Calculate Big Number Nac Temha <naccttemha@gmail.com> - 2013-01-08 02:44 +0200
  Re: Calculate Big Number Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-08 05:50 +0000
    Re: Calculate Big Number Gisle Vanem <gvanem@broadpark.no> - 2013-01-08 11:06 +0100
      Re: Calculate Big Number casevh@gmail.com - 2013-01-08 08:33 -0800
      Re: Calculate Big Number casevh@gmail.com - 2013-01-08 08:33 -0800

csiph-web