e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\begin{array}{l}
\mathbf{if}\;x.re \le 3.6042418809979 \cdot 10^{-310}:\\
\;\;\;\;e^{-1 \cdot \left(y.re \cdot \log \left(\frac{-1}{x.re}\right)\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\\
\mathbf{elif}\;x.re \le 1.83089244802265445 \cdot 10^{-158}:\\
\;\;\;\;e^{\log x.re \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\\
\mathbf{elif}\;x.re \le 0.0561546188819968609:\\
\;\;\;\;e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\\
\mathbf{else}:\\
\;\;\;\;e^{\log x.re \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\\
\end{array}double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return (exp(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re))));
}
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double temp;
if ((x_46_re <= 3.60424188099793e-310)) {
temp = (exp(((-1.0 * (y_46_re * log((-1.0 / x_46_re)))) - (atan2(x_46_im, x_46_re) * y_46_im))) * 1.0);
} else {
double temp_1;
if ((x_46_re <= 1.8308924480226544e-158)) {
temp_1 = (exp(((log(x_46_re) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * 1.0);
} else {
double temp_2;
if ((x_46_re <= 0.05615461888199686)) {
temp_2 = (exp(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * 1.0);
} else {
temp_2 = (exp(((log(x_46_re) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * 1.0);
}
temp_1 = temp_2;
}
temp = temp_1;
}
return temp;
}



Bits error versus x.re



Bits error versus x.im



Bits error versus y.re



Bits error versus y.im
Results
if x.re < 3.60424188099793e-310Initial program 32.1
Taylor expanded around 0 18.1
Taylor expanded around -inf 5.3
if 3.60424188099793e-310 < x.re < 1.8308924480226544e-158 or 0.05615461888199686 < x.re Initial program 40.3
Taylor expanded around 0 25.6
Taylor expanded around inf 11.3
if 1.8308924480226544e-158 < x.re < 0.05615461888199686Initial program 18.0
Taylor expanded around 0 11.3
Final simplification8.3
herbie shell --seed 2020066
(FPCore (x.re x.im y.re y.im)
:name "powComplex, real part"
:precision binary64
(* (exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) (* (atan2 x.im x.re) y.im))) (cos (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))))