David Eppstein eppstein at
Sun Sep 21 23:58:11 CEST 2003

In article <mailman.1064176468.3210.python-list at>,
 "Tim Peters" < at> wrote:

> > >>> math.e**(1j*math.pi) (-1+1.2246467991473532e-16j)
> Or, in this case, use the builtin pow(), which looks for a __pow__ method,
> which is the same thing "**" does.  Math libraries in general can return a
> better result for exp(x) than e**x, though, since the latter form uses a
> machine approximation to e as the base.

Doesn't look especially different to me, for the numbers I'm currently 
interested in applying this to (small pure imaginary):

>>> from cmath import *
>>> exp(1j*pi)
>>> e**(1j*pi)

David Eppstein            
Univ. of California, Irvine, School of Information & Computer Science

More information about the Python-list mailing list