[Tutor] power of 2.718282

Alan Gauld alan.gauld at btinternet.com
Tue Jan 13 22:39:51 CET 2009

"culpritNr1" <ig2ar-saf1 at yahoo.co.uk> wrote

> I would appreciate a low level solution because I have to 
> iteratively call
> that computation millions of times. Anything more efficient than
> 2.718182**10 may be good.

Umm, what's wrong with

from math import e  # more precision than 2.718182
print e**10

e**10 is shorter to type and probably just as fast as a function
call (if not faster!).

I see others have pointed out that the math module has this covered
but I'm curious about your definition of efficiency?

Alan G. 

More information about the Tutor mailing list