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 \sin \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.re, x.im\right)\right)\\
t_1 := \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\\
\mathbf{if}\;x.re \leq -2.675854181798536 \cdot 10^{+193}:\\
\;\;\;\;\begin{array}{l}
t_2 := \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re}}\\
t_1 \cdot \sin \left(\mathsf{fma}\left(t_0, y.im, t_2 \cdot \left(y.re \cdot \left(t_2 \cdot t_2\right)\right)\right)\right)
\end{array}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_3 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_4 := {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \sin \left(\mathsf{fma}\left(t_0, y.im, t_3\right)\right)\\
\mathbf{if}\;x.re \leq -13778.819173053213:\\
\;\;\;\;t_4\\
\mathbf{elif}\;x.re \leq -2.9082658274636224 \cdot 10^{-166}:\\
\;\;\;\;t_1 \cdot \sin \left(\mathsf{fma}\left(t_0, y.im, \mathsf{expm1}\left(\mathsf{log1p}\left(t_3\right)\right)\right)\right)\\
\mathbf{elif}\;x.re \leq 1.0159450429663836 \cdot 10^{-77}:\\
\;\;\;\;\begin{array}{l}
t_5 := \sqrt[3]{t_3}\\
t_1 \cdot \sin \left(\mathsf{fma}\left(t_0, y.im, t_5 \cdot \left(t_5 \cdot t_5\right)\right)\right)
\end{array}\\
\mathbf{elif}\;x.re \leq 1.3769665612619498 \cdot 10^{+73}:\\
\;\;\;\;\begin{array}{l}
t_6 := \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
t_7 := \sin t_3\\
t_1 \cdot \left(\mathsf{fma}\left(\cos t_3, y.im \cdot t_6, t_7\right) - 0.5 \cdot \left({t_6}^{2} \cdot \left(t_7 \cdot \left(y.im \cdot y.im\right)\right)\right)\right)
\end{array}\\
\mathbf{else}:\\
\;\;\;\;t_4\\
\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)))
(sin
(+
(* (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.re x.im)))
(t_1
(/ (pow (hypot x.re x.im) y.re) (exp (* (atan2 x.im x.re) y.im)))))
(if (<= x.re -2.675854181798536e+193)
(let* ((t_2 (cbrt (atan2 x.im x.re))))
(* t_1 (sin (fma t_0 y.im (* t_2 (* y.re (* t_2 t_2)))))))
(let* ((t_3 (* y.re (atan2 x.im x.re)))
(t_4 (* (pow (hypot x.im x.re) y.re) (sin (fma t_0 y.im t_3)))))
(if (<= x.re -13778.819173053213)
t_4
(if (<= x.re -2.9082658274636224e-166)
(* t_1 (sin (fma t_0 y.im (expm1 (log1p t_3)))))
(if (<= x.re 1.0159450429663836e-77)
(let* ((t_5 (cbrt t_3)))
(* t_1 (sin (fma t_0 y.im (* t_5 (* t_5 t_5))))))
(if (<= x.re 1.3769665612619498e+73)
(let* ((t_6 (log (hypot x.im x.re))) (t_7 (sin t_3)))
(*
t_1
(-
(fma (cos t_3) (* y.im t_6) t_7)
(* 0.5 (* (pow t_6 2.0) (* t_7 (* y.im y.im)))))))
t_4))))))))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)) * sin((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_re, x_46_im));
double t_1 = pow(hypot(x_46_re, x_46_im), y_46_re) / exp(atan2(x_46_im, x_46_re) * y_46_im);
double tmp;
if (x_46_re <= -2.675854181798536e+193) {
double t_2_1 = cbrt(atan2(x_46_im, x_46_re));
tmp = t_1 * sin(fma(t_0, y_46_im, (t_2_1 * (y_46_re * (t_2_1 * t_2_1)))));
} else {
double t_3 = y_46_re * atan2(x_46_im, x_46_re);
double t_4 = pow(hypot(x_46_im, x_46_re), y_46_re) * sin(fma(t_0, y_46_im, t_3));
double tmp_2;
if (x_46_re <= -13778.819173053213) {
tmp_2 = t_4;
} else if (x_46_re <= -2.9082658274636224e-166) {
tmp_2 = t_1 * sin(fma(t_0, y_46_im, expm1(log1p(t_3))));
} else if (x_46_re <= 1.0159450429663836e-77) {
double t_5 = cbrt(t_3);
tmp_2 = t_1 * sin(fma(t_0, y_46_im, (t_5 * (t_5 * t_5))));
} else if (x_46_re <= 1.3769665612619498e+73) {
double t_6 = log(hypot(x_46_im, x_46_re));
double t_7 = sin(t_3);
tmp_2 = t_1 * (fma(cos(t_3), (y_46_im * t_6), t_7) - (0.5 * (pow(t_6, 2.0) * (t_7 * (y_46_im * y_46_im)))));
} else {
tmp_2 = t_4;
}
tmp = tmp_2;
}
return tmp;
}



Bits error versus x.re



Bits error versus x.im



Bits error versus y.re



Bits error versus y.im
if x.re < -2.6758541817985359e193Initial program 64.0
Simplified18.5
Applied add-cube-cbrt_binary6417.9
Applied associate-*r*_binary6418.5
if -2.6758541817985359e193 < x.re < -13778.819173053213 or 1.3769665612619498e73 < x.re Initial program 42.5
Simplified17.8
Taylor expanded in y.im around 0 31.1
Simplified24.1
if -13778.819173053213 < x.re < -2.9082658274636224e-166Initial program 26.1
Simplified17.1
Applied expm1-log1p-u_binary6426.2
if -2.9082658274636224e-166 < x.re < 1.0159450429663836e-77Initial program 35.9
Simplified19.1
Applied add-cube-cbrt_binary6419.1
if 1.0159450429663836e-77 < x.re < 1.3769665612619498e73Initial program 27.7
Simplified16.8
Taylor expanded in y.im around 0 34.8
Simplified24.4
Final simplification22.4
herbie shell --seed 2022067
(FPCore (x.re x.im y.re y.im)
:name "powComplex, imaginary part"
:precision binary64
(* (exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) (* (atan2 x.im x.re) y.im))) (sin (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))))