nth root

Dan Goodman dg.gmane at thesamovar.net
Sat Jan 31 06:11:10 CET 2009

Takes less than 1 sec here to do (10**100)**(1./13) a million times, and 
only about half as long to do (1e100)**(1./13), or about 14 times as 
long as to do .2**2. Doesn't look like one could hope for it to be that 
much quicker as you need 9 sig figs of accuracy to get the integer part 
of (10**100)**(1./13) (floats have about 7 and doubles about 16).


Tim wrote:
> In PythonWin I'm running a program to find the 13th root (say) of 
> millions of hundred-digit numbers.  I'm using
>     n = 13
>     root = base**(1.0/n)
> which correctly computes the root to a large number of decimal 
> places, but therefore takes a long time.  All I need is the integer 
> component.  Is there a quicker way?
> ------------------------------------------------------------------------
> --
> http://mail.python.org/mailman/listinfo/python-list

More information about the Python-list mailing list