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^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}\\
\mathbf{if}\;y.im \leq -7.512750821835541 \cdot 10^{+133}:\\
\;\;\;\;t_1 \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\sin \left(\left(\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}\right) \cdot \left(\sqrt[3]{y.im} \cdot t_0\right)\right)\right)\right)\\
\mathbf{elif}\;y.im \leq -859914823969486.9 \lor \neg \left(y.im \leq 5.908482168426287 \cdot 10^{+93}\right):\\
\;\;\;\;t_1 \cdot \mathsf{expm1}\left(\mathsf{fma}\left(t_0, y.im, \left(\left(y.im \cdot y.im\right) \cdot {t_0}^{2}\right) \cdot -0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_2 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_3 := \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
t_4 := \sin t_2\\
t_1 \cdot \left(\mathsf{fma}\left(\cos t_2, y.im \cdot t_3, t_4\right) - 0.5 \cdot \left({t_3}^{2} \cdot \left(\left(y.im \cdot y.im\right) \cdot t_4\right)\right)\right)
\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 (* y.im (atan2 x.im x.re))))))
(if (<= y.im -7.512750821835541e+133)
(*
t_1
(expm1
(log1p (sin (* (* (cbrt y.im) (cbrt y.im)) (* (cbrt y.im) t_0))))))
(if (or (<= y.im -859914823969486.9)
(not (<= y.im 5.908482168426287e+93)))
(* t_1 (expm1 (fma t_0 y.im (* (* (* y.im y.im) (pow t_0 2.0)) -0.5))))
(let* ((t_2 (* y.re (atan2 x.im x.re)))
(t_3 (log (hypot x.im x.re)))
(t_4 (sin t_2)))
(*
t_1
(-
(fma (cos t_2) (* y.im t_3) t_4)
(* 0.5 (* (pow t_3 2.0) (* (* 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(y_46_im * atan2(x_46_im, x_46_re));
double tmp;
if (y_46_im <= -7.512750821835541e+133) {
tmp = t_1 * expm1(log1p(sin((cbrt(y_46_im) * cbrt(y_46_im)) * (cbrt(y_46_im) * t_0))));
} else if ((y_46_im <= -859914823969486.9) || !(y_46_im <= 5.908482168426287e+93)) {
tmp = t_1 * expm1(fma(t_0, y_46_im, (((y_46_im * y_46_im) * pow(t_0, 2.0)) * -0.5)));
} else {
double t_2 = y_46_re * atan2(x_46_im, x_46_re);
double t_3 = log(hypot(x_46_im, x_46_re));
double t_4 = sin(t_2);
tmp = t_1 * (fma(cos(t_2), (y_46_im * t_3), t_4) - (0.5 * (pow(t_3, 2.0) * ((y_46_im * y_46_im) * t_4))));
}
return tmp;
}



Bits error versus x.re



Bits error versus x.im



Bits error versus y.re



Bits error versus y.im
if y.im < -7.51275082183554086e133Initial program 41.3
Simplified31.2
Applied expm1-log1p-u_binary6431.2
Taylor expanded in y.re around 0 46.6
Simplified30.9
Applied add-cube-cbrt_binary6430.8
Applied associate-*l*_binary6430.8
Simplified30.8
if -7.51275082183554086e133 < y.im < -859914823969486.875 or 5.90848216842628677e93 < y.im Initial program 41.6
Simplified29.3
Applied expm1-log1p-u_binary6429.3
Taylor expanded in y.re around 0 46.8
Simplified29.3
Taylor expanded in y.im around 0 39.6
Simplified28.6
if -859914823969486.875 < y.im < 5.90848216842628677e93Initial program 36.1
Simplified9.9
Taylor expanded in y.im around 0 36.3
Simplified11.0
Final simplification18.5
herbie shell --seed 2022068
(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)))))