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 -5.36951614796057 \cdot 10^{-310}:\\
\;\;\;\;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(y.im \cdot \log \left(-x.im\right) + y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{elif}\;x.im \leq 1.4292601098046946 \cdot 10^{-265} \lor \neg \left(x.im \leq 3.600263651005658 \cdot 10^{-58}\right):\\
\;\;\;\;e^{y.re \cdot \log x.im - \left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}\right) \cdot \left(y.im \cdot \left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}}\right)\right)\right)} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} + y.im \cdot \log x.im\right)\\
\mathbf{else}:\\
\;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} + y.im \cdot \log x.im\right) \cdot e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}\right) \cdot \left(y.im \cdot \left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}}\right)\right)\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.im -5.36951614796057e-310)
(*
(exp
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(* (atan2 x.im x.re) y.im)))
(cos (+ (* y.im (log (- x.im))) (* y.re (atan2 x.im x.re)))))
(if (or (<= x.im 1.4292601098046946e-265)
(not (<= x.im 3.600263651005658e-58)))
(*
(exp
(-
(* y.re (log x.im))
(*
(* (cbrt (atan2 x.im x.re)) (cbrt (atan2 x.im x.re)))
(*
y.im
(*
(cbrt (cbrt (atan2 x.im x.re)))
(*
(cbrt (cbrt (atan2 x.im x.re)))
(cbrt (cbrt (atan2 x.im x.re)))))))))
(cos (+ (* y.re (atan2 x.im x.re)) (* y.im (log x.im)))))
(*
(cos (+ (* y.re (atan2 x.im x.re)) (* y.im (log x.im))))
(exp
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(*
(* (cbrt (atan2 x.im x.re)) (cbrt (atan2 x.im x.re)))
(*
y.im
(*
(cbrt (cbrt (atan2 x.im x.re)))
(*
(cbrt (cbrt (atan2 x.im x.re)))
(cbrt (cbrt (atan2 x.im 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_im <= -5.36951614796057e-310) {
tmp = 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((y_46_im * log(-x_46_im)) + (y_46_re * atan2(x_46_im, x_46_re)));
} else if ((x_46_im <= 1.4292601098046946e-265) || !(x_46_im <= 3.600263651005658e-58)) {
tmp = exp((y_46_re * log(x_46_im)) - ((cbrt(atan2(x_46_im, x_46_re)) * cbrt(atan2(x_46_im, x_46_re))) * (y_46_im * (cbrt(cbrt(atan2(x_46_im, x_46_re))) * (cbrt(cbrt(atan2(x_46_im, x_46_re))) * cbrt(cbrt(atan2(x_46_im, x_46_re)))))))) * cos((y_46_re * atan2(x_46_im, x_46_re)) + (y_46_im * log(x_46_im)));
} else {
tmp = cos((y_46_re * atan2(x_46_im, x_46_re)) + (y_46_im * log(x_46_im))) * exp((log(sqrt((x_46_re * x_46_re) + (x_46_im * x_46_im))) * y_46_re) - ((cbrt(atan2(x_46_im, x_46_re)) * cbrt(atan2(x_46_im, x_46_re))) * (y_46_im * (cbrt(cbrt(atan2(x_46_im, x_46_re))) * (cbrt(cbrt(atan2(x_46_im, x_46_re))) * cbrt(cbrt(atan2(x_46_im, 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.im < -5.36951614796057e-310Initial program 32.8
Taylor expanded around -inf 20.0
Simplified20.0
if -5.36951614796057e-310 < x.im < 1.42926010980469464e-265 or 3.60026365100565798e-58 < x.im Initial program 36.5
rmApplied add-cube-cbrt_binary6436.5
Applied associate-*l*_binary6436.5
Simplified36.5
rmApplied add-cube-cbrt_binary6436.5
Taylor expanded around 0 21.8
Taylor expanded around 0 6.0
if 1.42926010980469464e-265 < x.im < 3.60026365100565798e-58Initial program 27.0
rmApplied add-cube-cbrt_binary6427.0
Applied associate-*l*_binary6427.0
Simplified27.0
rmApplied add-cube-cbrt_binary6427.0
Taylor expanded around 0 18.3
Final simplification15.2
herbie shell --seed 2021060
(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)))))