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 -6.03337378985148379 \cdot 10^{-227}:\\
\;\;\;\;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 -2.6469714819887294 \cdot 10^{-247}:\\
\;\;\;\;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 \sqrt[3]{{\left(\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)\right)}^{3}}\\
\mathbf{elif}\;x.re \le -1.356366458857769 \cdot 10^{-310}:\\
\;\;\;\;\left(\sqrt{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 \sqrt{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}}\right) \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 VAR;
if ((x_46_re <= -6.033373789851484e-227)) {
VAR = (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 VAR_1;
if ((x_46_re <= -2.6469714819887294e-247)) {
VAR_1 = (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))) * cbrt(pow(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))), 3.0)));
} else {
double VAR_2;
if ((x_46_re <= -1.35636645885777e-310)) {
VAR_2 = ((sqrt(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)))) * sqrt(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 {
VAR_2 = (exp(((log(x_46_re) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * 1.0);
}
VAR_1 = VAR_2;
}
VAR = VAR_1;
}
return VAR;
}



Bits error versus x.re



Bits error versus x.im



Bits error versus y.re



Bits error versus y.im
Results
if x.re < -6.033373789851484e-227Initial program 31.7
Taylor expanded around 0 17.4
Taylor expanded around -inf 5.4
if -6.033373789851484e-227 < x.re < -2.6469714819887294e-247Initial program 33.2
rmApplied add-cbrt-cube33.2
Simplified33.2
if -2.6469714819887294e-247 < x.re < -1.35636645885777e-310Initial program 31.9
Taylor expanded around 0 16.4
rmApplied add-sqr-sqrt16.4
if -1.35636645885777e-310 < x.re Initial program 35.2
Taylor expanded around 0 22.2
Taylor expanded around inf 11.1
Final simplification9.3
herbie shell --seed 2020078
(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)))))