Re: Computing exp(z)



In article <d6htql$rbq$1@xxxxxxxxxxxxxxxxxx>,
"gh14tq5@xxxxxxxxx" <gh14tq5@xxxxxxxxx> wrote:

> Are there any disadvantages/pitfalls to computing exp(z) as
>
> exp(z) = exp(real(z))*(cos(aimag(z)),sin(aimag(z)))

One possible disadvantage is that this is not the correct equation.
At least it isn't the one that I've always used. Did you compare
results to see if your equation was correct? What you want, I
think, is something like:

r = abs(z)
theta = atan2(real(z),aimag(z))
expz = exp(r) * complx( cos(theta), sin(theta) )

Of course, you need to test for r=0.0 and so on, but you get the
point. I doubt that the intrinsic exp(z) is slower than this.

$.02 -Ron Shepard
.