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 \leq -1.848237701150158 \cdot 10^{-101}:\\
\;\;\;\;e^{\log \left(-x.re\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{elif}\;x.re \leq -1.6071323931041203 \cdot 10^{-204}:\\
\;\;\;\;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{elif}\;x.re \leq 3.39539490050286 \cdot 10^{-310}:\\
\;\;\;\;e^{\log \left(-x.re\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{elif}\;x.re \leq 9.97621392264661 \cdot 10^{-165} \lor \neg \left(x.re \leq 3.5492325277206613 \cdot 10^{-44}\right):\\
\;\;\;\;e^{y.re \cdot \log x.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{else}:\\
\;\;\;\;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 x.re\right)\\
\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.re -1.848237701150158e-101)
(exp (- (* (log (- x.re)) y.re) (* (atan2 x.im x.re) y.im)))
(if (<= x.re -1.6071323931041203e-204)
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im)))
(if (<= x.re 3.39539490050286e-310)
(exp (- (* (log (- x.re)) y.re) (* (atan2 x.im x.re) y.im)))
(if (or (<= x.re 9.97621392264661e-165)
(not (<= x.re 3.5492325277206613e-44)))
(exp (- (* y.re (log x.re)) (* (atan2 x.im x.re) y.im)))
(*
(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 x.re))))))))))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_re <= -1.848237701150158e-101) {
tmp = exp((log(-x_46_re) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im));
} else if (x_46_re <= -1.6071323931041203e-204) {
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));
} else if (x_46_re <= 3.39539490050286e-310) {
tmp = exp((log(-x_46_re) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im));
} else if ((x_46_re <= 9.97621392264661e-165) || !(x_46_re <= 3.5492325277206613e-44)) {
tmp = exp((y_46_re * log(x_46_re)) - (atan2(x_46_im, x_46_re) * y_46_im));
} else {
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(x_46_re)));
}
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.re < -1.84823770115015798e-101 or -1.6071323931041203e-204 < x.re < 3.395394900502857e-310Initial program 34.1
Taylor expanded around 0 18.3
Taylor expanded around -inf 4.7
Simplified4.7
if -1.84823770115015798e-101 < x.re < -1.6071323931041203e-204Initial program 22.8
Taylor expanded around 0 12.7
if 3.395394900502857e-310 < x.re < 9.97621392264661044e-165 or 3.5492325277206613e-44 < x.re Initial program 37.7
Taylor expanded around 0 23.3
Taylor expanded around inf 11.4
if 9.97621392264661044e-165 < x.re < 3.5492325277206613e-44Initial program 17.7
Taylor expanded around inf 11.3
Simplified11.3
Final simplification8.7
herbie shell --seed 2020343
(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)))))