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.1018666543681226 \cdot 10^{+83}:\\
\;\;\;\;e^{\log \left(-x.re\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{elif}\;x.re \leq -7.429944111692088 \cdot 10^{-189}:\\
\;\;\;\;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 -5.1084976626782 \cdot 10^{-311}:\\
\;\;\;\;e^{\log \left(-x.re\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{elif}\;x.re \leq 6.478699131241855 \cdot 10^{-157} \lor \neg \left(x.re \leq 1.2402240252271068 \cdot 10^{+68}\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.1018666543681226e+83)
(exp (- (* (log (- x.re)) y.re) (* (atan2 x.im x.re) y.im)))
(if (<= x.re -7.429944111692088e-189)
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im)))
(if (<= x.re -5.1084976626782e-311)
(exp (- (* (log (- x.re)) y.re) (* (atan2 x.im x.re) y.im)))
(if (or (<= x.re 6.478699131241855e-157)
(not (<= x.re 1.2402240252271068e+68)))
(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.1018666543681226e+83) {
tmp = exp((log(-x_46_re) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im));
} else if (x_46_re <= -7.429944111692088e-189) {
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 <= -5.1084976626782e-311) {
tmp = exp((log(-x_46_re) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im));
} else if ((x_46_re <= 6.478699131241855e-157) || !(x_46_re <= 1.2402240252271068e+68)) {
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.10186665436812262e83 or -7.42994411169208815e-189 < x.re < -5.10849766267821e-311Initial program 42.0
Taylor expanded around 0 22.9
Taylor expanded around -inf 4.4
Simplified4.4
if -1.10186665436812262e83 < x.re < -7.42994411169208815e-189Initial program 16.2
Taylor expanded around 0 8.8
if -5.10849766267821e-311 < x.re < 6.4786991312418545e-157 or 1.24022402522710678e68 < x.re Initial program 42.6
Taylor expanded around 0 27.4
Taylor expanded around inf 12.0
if 6.4786991312418545e-157 < x.re < 1.24022402522710678e68Initial program 20.2
Taylor expanded around inf 13.0
Simplified13.0
Final simplification9.4
herbie shell --seed 2020342
(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)))))