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}
t_0 := \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
t_1 := {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\\
t_2 := \frac{t_1}{\mathsf{fma}\left(y.im, \tan^{-1}_* \frac{x.im}{x.re}, 1\right)} \cdot \cos \left(y.im \cdot t_0\right)\\
\mathbf{if}\;y.re \leq -10650560034225.063:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_3 := \sqrt[3]{y.im} \cdot \sqrt[3]{y.im}\\
t_4 := \frac{t_1}{e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}\\
\mathbf{if}\;y.re \leq 8.81112223723101 \cdot 10^{-16}:\\
\;\;\;\;t_4 \cdot \cos \left(\left(\sqrt[3]{y.im} \cdot \sqrt[3]{\sqrt[3]{y.im} \cdot t_3}\right) \cdot \left(t_0 \cdot \sqrt[3]{y.im}\right)\right)\\
\mathbf{elif}\;y.re \leq 7.380232567388229 \cdot 10^{+91}:\\
\;\;\;\;\begin{array}{l}
t_5 := \sqrt[3]{\mathsf{hypot}\left(x.im, x.re\right)}\\
t_6 := t_3 \cdot \left(\sqrt[3]{y.im} \cdot \log \left(t_5 \cdot t_5\right)\right)\\
t_7 := t_3 \cdot \left(\sqrt[3]{y.im} \cdot \log t_5\right)\\
t_4 \cdot \left(\cos t_6 \cdot \cos t_7 - \sin t_6 \cdot \sin t_7\right)
\end{array}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}\\
\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
(let* ((t_0 (log (hypot x.im x.re)))
(t_1 (pow (hypot x.re x.im) y.re))
(t_2 (* (/ t_1 (fma y.im (atan2 x.im x.re) 1.0)) (cos (* y.im t_0)))))
(if (<= y.re -10650560034225.063)
t_2
(let* ((t_3 (* (cbrt y.im) (cbrt y.im)))
(t_4 (/ t_1 (exp (* y.im (atan2 x.im x.re))))))
(if (<= y.re 8.81112223723101e-16)
(*
t_4
(cos
(* (* (cbrt y.im) (cbrt (* (cbrt y.im) t_3))) (* t_0 (cbrt y.im)))))
(if (<= y.re 7.380232567388229e+91)
(let* ((t_5 (cbrt (hypot x.im x.re)))
(t_6 (* t_3 (* (cbrt y.im) (log (* t_5 t_5)))))
(t_7 (* t_3 (* (cbrt y.im) (log t_5)))))
(* t_4 (- (* (cos t_6) (cos t_7)) (* (sin t_6) (sin t_7)))))
t_2))))))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 t_0 = log(hypot(x_46_im, x_46_re));
double t_1 = pow(hypot(x_46_re, x_46_im), y_46_re);
double t_2 = (t_1 / fma(y_46_im, atan2(x_46_im, x_46_re), 1.0)) * cos(y_46_im * t_0);
double tmp;
if (y_46_re <= -10650560034225.063) {
tmp = t_2;
} else {
double t_3 = cbrt(y_46_im) * cbrt(y_46_im);
double t_4 = t_1 / exp(y_46_im * atan2(x_46_im, x_46_re));
double tmp_1;
if (y_46_re <= 8.81112223723101e-16) {
tmp_1 = t_4 * cos((cbrt(y_46_im) * cbrt(cbrt(y_46_im) * t_3)) * (t_0 * cbrt(y_46_im)));
} else if (y_46_re <= 7.380232567388229e+91) {
double t_5 = cbrt(hypot(x_46_im, x_46_re));
double t_6 = t_3 * (cbrt(y_46_im) * log(t_5 * t_5));
double t_7 = t_3 * (cbrt(y_46_im) * log(t_5));
tmp_1 = t_4 * ((cos(t_6) * cos(t_7)) - (sin(t_6) * sin(t_7)));
} else {
tmp_1 = t_2;
}
tmp = tmp_1;
}
return tmp;
}



Bits error versus x.re



Bits error versus x.im



Bits error versus y.re



Bits error versus y.im
if y.re < -10650560034225.06 or 7.3802325673882287e91 < y.re Initial program 39.6
Simplified25.4
Taylor expanded in y.re around 0 43.2
Simplified21.8
Taylor expanded in y.im around 0 15.5
Simplified15.5
if -10650560034225.06 < y.re < 8.81112223723100955e-16Initial program 36.5
Simplified10.2
Taylor expanded in y.re around 0 36.7
Simplified10.4
Applied add-cube-cbrt_binary6410.8
Applied associate-*l*_binary6411.1
Applied add-cbrt-cube_binary6410.8
if 8.81112223723100955e-16 < y.re < 7.3802325673882287e91Initial program 37.8
Simplified26.8
Taylor expanded in y.re around 0 42.7
Simplified23.8
Applied add-cube-cbrt_binary6423.6
Applied associate-*l*_binary6423.2
Applied add-cube-cbrt_binary6423.5
Applied log-prod_binary6423.0
Applied distribute-rgt-in_binary6423.4
Applied distribute-rgt-in_binary6423.6
Applied cos-sum_binary6423.6
Final simplification13.8
herbie shell --seed 2022068
(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)))))