Step by step:
$$
\begin{array}{rcl}
&& x + jy = (a + jb)^{c+jd} \\
&=& (re^{j\theta})^{c+jd} \\
&=& r^{c+jd} (e^{j\theta})^{c+jd} \\
&=& r^cr^{jd} e^{j\theta c}e^{-\theta d} \\
&=& r^c e^{\displaystyle\ln r^{jd}} e^{j\theta c}e^{-\theta d} \\
&=& r^c e^{-\theta d} e^{\displaystyle jd \ln r} e^{\displaystyle j\theta c} \\
&=& r^c e^{-\theta d} e^{\displaystyle j(d \ln r + \theta c)} \\
&=& r^c e^{-\theta d} [\cos(d \ln r + \theta c) + j\sin(d \ln r + \theta c)] \\
&=& [r^c e^{-\theta d} \cos(d \ln r + \theta c)] + j[r^c e^{-\theta d}\sin(d \ln r + \theta c)] \\
&=& \left[(a^2+b^2)^{c/2} e^{-\theta d} \cos\left(d \ln(\sqrt{a^2+b^2}) + \theta c\right)\right] + \\
&& \left[(a^2+b^2)^{c/2} e^{-\theta d}\sin\left(d \ln((a^2+b^2)^{1/2}) + \theta c\right)\right]j \\
&=& \left[(a^2+b^2)^{c/2} e^{-\theta d} \cos\left(\frac{d}{2} \ln(a^2+b^2) + \theta c\right)\right] + \\
&& \left[(a^2+b^2)^{c/2} e^{-\theta d}\sin\left(\frac{d}{2} \ln(a^2+b^2) + \theta c\right)\right]j \\
&=& \begin{cases}
\left[(a^2+b^2)^{c/2} e^{-d\arctan(\frac{b}{a})} \cos\left(\frac{d}{2} \ln(a^2+b^2) + c\,\arctan(\frac{b}{a})\right)\right] + &\\
\left[(a^2+b^2)^{c/2} e^{-d\arctan(\frac{b}{a})} \sin\left(\frac{d}{2} \ln(a^2+b^2) + c\,\arctan(\frac{b}{a})\right)\right]j & \text{if} \; a\!>\!0 \\
\left[(a^2+b^2)^{c/2} e^{-d\arctan(\frac{b}{a}) - \pi d} \cos\left(\frac{d}{2} \ln(a^2+b^2) + c\,\arctan(\frac{b}{a}) + \pi c\right)\right] + & \\
\left[(a^2+b^2)^{c/2} e^{-d\arctan(\frac{b}{a}) - \pi d} \sin\left(\frac{d}{2} \ln(a^2+b^2) + c\,\arctan(\frac{b}{a}) + \pi c\right)\right]j & \text{if} \; a\!<\!0 \; \text{and} \; b \!\ge\! 0 \\
\left[(a^2+b^2)^{c/2} e^{-d\arctan(\frac{b}{a}) + \pi d} \cos\left(\frac{d}{2} \ln(a^2+b^2) + c\,\arctan(\frac{b}{a}) - \pi c\right)\right] + & \\
\left[(a^2+b^2)^{c/2} e^{-d\arctan(\frac{b}{a}) + \pi d} \sin\left(\frac{d}{2} \ln(a^2+b^2) + c\,\arctan(\frac{b}{a}) - \pi c\right)\right]j & \text{if} \; a\!<\!0 \; \text{and} \; b\!<\!0 \\
\left[(a^2+b^2)^{c/2} e^{-\frac{\pi d}{2}} \cos\left(\frac{d}{2} \ln(a^2+b^2) + \frac{\pi c}{2}\right)\right] + & \\
\left[(a^2+b^2)^{c/2} e^{-\frac{\pi d}{2}} \sin\left(\frac{d}{2} \ln(a^2+b^2) + \frac{\pi c}{2}\right)\right]j & \text{if} \; a\!=\!0 \; \text{and} \; b\!>\!0 \\
\left[(a^2+b^2)^{c/2} e^{+\frac{\pi d}{2}} \cos\left(\frac{d}{2} \ln(a^2+b^2) - \frac{\pi c}{2}\right)\right] + & \\
\left[(a^2+b^2)^{c/2} e^{+\frac{\pi d}{2}} \sin\left(\frac{d}{2} \ln(a^2+b^2) - \frac{\pi c}{2}\right)\right]j & \text{if} \; a\!=\!0 \; \text{and} \; b\!<\!0 \\
0 & \text{if} \; a\!=\!0 \; \text{and} \; b\!=\!0 \\
\end{cases}
\end{array}
$$
Implementation in computer:
ComplexNumber ComplexNumber::TakePower(const ComplexNumber & Base, const ComplexNumber & Exponent)
{
// x + jy = (a + jb)^(c + jd)
double x, y;
double a = Base.GetRealPart();
double b = Base.GetImaginaryPart();
if (IsZero(a) & IsZero(b))
{
x = 0.0;
y = 0.0;
}
else
{
double c = Exponent.GetRealPart();
double d = Exponent.GetImaginaryPart();
double r2 = a * a + b * b;
double t = Base.GetAngle();
x = pow(r2, c/2.0) * exp(-t*d) * cos((d/2.0) * log(r2) + t*c);
y = pow(r2, c/2.0) * exp(-t*d) * sin((d/2.0) * log(r2) + t*c);
}
return ComplexNumber(x, y);
}
Testing for $e^{j\pi}\!=\!-1$:
double e = 2.71828182845904523536028747135266249775724709369995;
double pi = 3.1415926535897932384626433832795;
ComplexNumber cne(e, 0);
ComplexNumber cni(0, pi);
ComplexNumber cnei = cne.GetPower(cni);
std::cout << "e^(j*pi) = " << cnei.ToString() << std::endl;
Program output:
e^(j*pi) = -1+j1.22465e-016
My implementation calculates $e^{j\pi}$ as $-1\!+\!j1.22465\!\times\!10^{-16}$. I don't know the reason for the error in the imaginary part, but the result is still very close enough to the actual one.