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.im \leq -0.1567682849090526:\\
\;\;\;\;e^{\log \left(-x.im\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{elif}\;x.im \leq -2.5341068578095944 \cdot 10^{-163}:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} - y.im \cdot \log \left(\frac{-1}{x.im}\right)\right)\\
\mathbf{elif}\;x.im \leq -4.449935006270931 \cdot 10^{-241}:\\
\;\;\;\;e^{\log \left(-x.im\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{elif}\;x.im \leq 2.76765119975385 \cdot 10^{-310} \lor \neg \left(x.im \leq 3.0726427254929475 \cdot 10^{-191}\right) \land x.im \leq 0.020903545878702613:\\
\;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot e^{y.re \cdot \log x.im - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\end{array}(FPCore (x.re x.im y.re y.im)
: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)))))(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= x.im -0.1567682849090526)
(*
(exp (- (* (log (- x.im)) y.re) (* (atan2 x.im x.re) y.im)))
(cos (* y.re (atan2 x.im x.re))))
(if (<= x.im -2.5341068578095944e-163)
(*
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im)))
(cos (- (* y.re (atan2 x.im x.re)) (* y.im (log (/ -1.0 x.im))))))
(if (<= x.im -4.449935006270931e-241)
(*
(exp (- (* (log (- x.im)) y.re) (* (atan2 x.im x.re) y.im)))
(cos (* y.re (atan2 x.im x.re))))
(if (or (<= x.im 2.76765119975385e-310)
(and (not (<= x.im 3.0726427254929475e-191))
(<= x.im 0.020903545878702613)))
(*
(cos (* y.re (atan2 x.im x.re)))
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im))))
(*
(cos (* y.re (atan2 x.im x.re)))
(exp (- (* y.re (log x.im)) (* (atan2 x.im x.re) y.im)))))))))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 tmp;
if (x_46_im <= -0.1567682849090526) {
tmp = exp((log(-x_46_im) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)) * cos(y_46_re * atan2(x_46_im, x_46_re));
} else if (x_46_im <= -2.5341068578095944e-163) {
tmp = exp((y_46_re * log(sqrt((x_46_re * x_46_re) + (x_46_im * x_46_im)))) - (atan2(x_46_im, x_46_re) * y_46_im)) * cos((y_46_re * atan2(x_46_im, x_46_re)) - (y_46_im * log(-1.0 / x_46_im)));
} else if (x_46_im <= -4.449935006270931e-241) {
tmp = exp((log(-x_46_im) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)) * cos(y_46_re * atan2(x_46_im, x_46_re));
} else if ((x_46_im <= 2.76765119975385e-310) || (!(x_46_im <= 3.0726427254929475e-191) && (x_46_im <= 0.020903545878702613))) {
tmp = cos(y_46_re * atan2(x_46_im, x_46_re)) * exp((y_46_re * log(sqrt((x_46_re * x_46_re) + (x_46_im * x_46_im)))) - (atan2(x_46_im, x_46_re) * y_46_im));
} else {
tmp = cos(y_46_re * atan2(x_46_im, x_46_re)) * exp((y_46_re * log(x_46_im)) - (atan2(x_46_im, x_46_re) * y_46_im));
}
return tmp;
}



Bits error versus x.re



Bits error versus x.im



Bits error versus y.re



Bits error versus y.im
Results
if x.im < -0.15676828490905259 or -2.53410685780959444e-163 < x.im < -4.44993500627093117e-241Initial program 39.2
Taylor expanded around 0 22.1
Taylor expanded around -inf 5.7
Simplified5.7
if -0.15676828490905259 < x.im < -2.53410685780959444e-163Initial program 19.5
Taylor expanded around -inf 12.4
if -4.44993500627093117e-241 < x.im < 2.767651199753846e-310 or 3.0726427254929475e-191 < x.im < 0.020903545878702613Initial program 24.3
Taylor expanded around 0 15.8
if 2.767651199753846e-310 < x.im < 3.0726427254929475e-191 or 0.020903545878702613 < x.im Initial program 38.0
Taylor expanded around 0 22.7
Taylor expanded around 0 6.9
Final simplification9.2
herbie shell --seed 2021050
(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)))))