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 -1.70372452559463588 \cdot 10^{-23}:\\
\;\;\;\;\frac{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{{\left(\frac{-1}{x.re}\right)}^{y.re}} \cdot 1\\
\mathbf{elif}\;x.re \le -3.01563396311001078 \cdot 10^{-182}:\\
\;\;\;\;\frac{\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) \cdot {\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}^{y.re}}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\\
\mathbf{elif}\;x.re \le 1.457786286792 \cdot 10^{-311}:\\
\;\;\;\;\frac{e^{-\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}{{\left(\frac{-1}{x.re}\right)}^{y.re}} \cdot 1\\
\mathbf{elif}\;x.re \le 3.3637837218998096 \cdot 10^{-91}:\\
\;\;\;\;e^{\log x.re \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\\
\mathbf{elif}\;x.re \le 1.2712943529250103 \cdot 10^{-21}:\\
\;\;\;\;e^{\log \left(\log \left(e^{\sqrt{x.re \cdot x.re + x.im \cdot x.im}}\right)\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 <= -1.703724525594636e-23)) {
temp = ((exp(-(atan2(x_46_im, x_46_re) * y_46_im)) / pow((-1.0 / x_46_re), y_46_re)) * 1.0);
} else {
double temp_1;
if ((x_46_re <= -3.015633963110011e-182)) {
temp_1 = ((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))) * pow(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))), y_46_re)) / exp((atan2(x_46_im, x_46_re) * y_46_im)));
} else {
double temp_2;
if ((x_46_re <= 1.457786286792e-311)) {
temp_2 = ((exp(-(atan2(x_46_im, x_46_re) * y_46_im)) / pow((-1.0 / x_46_re), y_46_re)) * 1.0);
} else {
double temp_3;
if ((x_46_re <= 3.3637837218998096e-91)) {
temp_3 = (exp(((log(x_46_re) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * 1.0);
} else {
double temp_4;
if ((x_46_re <= 1.2712943529250103e-21)) {
temp_4 = (exp(((log(log(exp(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_4 = (exp(((log(x_46_re) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * 1.0);
}
temp_3 = temp_4;
}
temp_2 = temp_3;
}
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 < -1.703724525594636e-23 or -3.015633963110011e-182 < x.re < 1.457786286792e-311Initial program 37.0
Taylor expanded around 0 20.7
Taylor expanded around -inf 3.7
Simplified9.8
if -1.703724525594636e-23 < x.re < -3.015633963110011e-182Initial program 17.5
Simplified21.9
if 1.457786286792e-311 < x.re < 3.3637837218998096e-91 or 1.2712943529250103e-21 < x.re Initial program 36.2
Taylor expanded around 0 22.9
Taylor expanded around inf 11.4
if 3.3637837218998096e-91 < x.re < 1.2712943529250103e-21Initial program 20.9
Taylor expanded around 0 14.3
rmApplied add-log-exp33.5
Final simplification13.5
herbie shell --seed 2020049
(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)))))