nth root

Dan Goodman dg.gmane at thesamovar.net
Sat Jan 31 12:43:08 EST 2009


Mark Dickinson wrote:
> Well, random numbers is one thing.  But how about the following:
> 
>>>> n = 12345**13
>>>> n
> 154662214940914131102165197707101295849230845947265625L
>>>> int(n ** (1./13))  # should be 12345; okay
> 12345
>>>> int((n-1) ** (1./13))  # should be 12344; oops!
> 12345

Good point! Oops indeed. :-)

Dan




More information about the Python-list mailing list