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 -2.64822747959788 \cdot 10^{-50}:\\
\;\;\;\;e^{\log \left(-x.re\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{elif}\;x.re \leq -3.0746072600574835 \cdot 10^{-153}:\\
\;\;\;\;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(\log \left(-x.re\right) \cdot y.im + y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{elif}\;x.re \leq -3.36918648162485 \cdot 10^{-310}:\\
\;\;\;\;e^{\log \left(-x.re\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.re - \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.re -2.64822747959788e-50)
(exp (- (* (log (- x.re)) y.re) (* (atan2 x.im x.re) y.im)))
(if (<= x.re -3.0746072600574835e-153)
(*
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im)))
(cos (+ (* (log (- x.re)) y.im) (* y.re (atan2 x.im x.re)))))
(if (<= x.re -3.36918648162485e-310)
(exp (- (* (log (- x.re)) y.re) (* (atan2 x.im x.re) y.im)))
(exp (- (* y.re (log x.re)) (* (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_re <= -2.64822747959788e-50) {
tmp = exp((log(-x_46_re) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im));
} else if (x_46_re <= -3.0746072600574835e-153) {
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((log(-x_46_re) * y_46_im) + (y_46_re * atan2(x_46_im, x_46_re)));
} else if (x_46_re <= -3.36918648162485e-310) {
tmp = exp((log(-x_46_re) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im));
} else {
tmp = exp((y_46_re * log(x_46_re)) - (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.re < -2.6482274795978799e-50 or -3.0746072600574835e-153 < x.re < -3.36918648162485e-310Initial program 35.6
Taylor expanded around 0 20.1
Taylor expanded around -inf 5.0
Simplified5.0
if -2.6482274795978799e-50 < x.re < -3.0746072600574835e-153Initial program 15.5
Taylor expanded around -inf 8.0
Simplified8.0
if -3.36918648162485e-310 < x.re Initial program 34.7
Taylor expanded around 0 21.1
Taylor expanded around inf 11.8
Final simplification8.7
herbie shell --seed 2020346
(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)))))