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 -326275111805596.6:\\
\;\;\;\;e^{\log \left(-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)} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{elif}\;x.im \leq -1.0023614876036504 \cdot 10^{-65}:\\
\;\;\;\;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.im \leq 4.3354624121682 \cdot 10^{-310}:\\
\;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot e^{\log \left(-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(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}} \cdot y.im\right)}\\
\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 -326275111805596.6)
(*
(exp
(-
(* (log (- 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)))))))))
(cos (* y.re (atan2 x.im x.re))))
(if (<= x.im -1.0023614876036504e-65)
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im)))
(if (<= x.im 4.3354624121682e-310)
(*
(cos (* y.re (atan2 x.im x.re)))
(exp
(-
(* (log (- x.im)) y.re)
(*
(* (cbrt (atan2 x.im x.re)) (cbrt (atan2 x.im x.re)))
(* (cbrt (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 <= -326275111805596.6) {
tmp = exp((log(-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)))))))) * cos(y_46_re * atan2(x_46_im, x_46_re));
} else if (x_46_im <= -1.0023614876036504e-65) {
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_im <= 4.3354624121682e-310) {
tmp = cos(y_46_re * atan2(x_46_im, x_46_re)) * exp((log(-x_46_im) * y_46_re) - ((cbrt(atan2(x_46_im, x_46_re)) * cbrt(atan2(x_46_im, x_46_re))) * (cbrt(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 < -326275111805596.62Initial program 41.8
Taylor expanded around 0 23.3
Taylor expanded around -inf 1.6
Simplified1.6
rmApplied add-cube-cbrt_binary641.6
Applied associate-*l*_binary641.6
Simplified1.6
rmApplied add-cube-cbrt_binary641.6
if -326275111805596.62 < x.im < -1.00236148760365044e-65Initial program 20.9
Taylor expanded around 0 12.1
Taylor expanded around 0 12.0
if -1.00236148760365044e-65 < x.im < 4.33546241216819e-310Initial program 28.1
Taylor expanded around 0 17.3
Taylor expanded around -inf 17.8
Simplified17.8
rmApplied add-cube-cbrt_binary6417.8
Applied associate-*l*_binary6417.8
if 4.33546241216819e-310 < x.im Initial program 33.2
Taylor expanded around 0 20.0
Taylor expanded around 0 9.6
Final simplification9.6
herbie shell --seed 2021044
(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)))))