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 := \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\\
\mathbf{if}\;y.re \leq -4.324564903364071 \cdot 10^{-19}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_1 := e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
\mathbf{if}\;y.re \leq 4.990997947076705 \cdot 10^{+91}:\\
\;\;\;\;t_0 \cdot \frac{1}{t_1}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{{\left(\frac{-1}{x.re}\right)}^{\left(-y.re\right)}}{t_1}\\
\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
(sin (fma (log (hypot x.re x.im)) y.im (* y.re (atan2 x.im x.re))))))
(if (<= y.re -4.324564903364071e-19)
(* (pow (hypot x.im x.re) y.re) t_0)
(let* ((t_1 (exp (* y.im (atan2 x.im x.re)))))
(if (<= y.re 4.990997947076705e+91)
(* t_0 (/ 1.0 t_1))
(* t_0 (/ (pow (/ -1.0 x.re) (- y.re)) t_1)))))))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 = sin(fma(log(hypot(x_46_re, x_46_im)), y_46_im, (y_46_re * atan2(x_46_im, x_46_re))));
double tmp;
if (y_46_re <= -4.324564903364071e-19) {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re) * t_0;
} else {
double t_1 = exp(y_46_im * atan2(x_46_im, x_46_re));
double tmp_1;
if (y_46_re <= 4.990997947076705e+91) {
tmp_1 = t_0 * (1.0 / t_1);
} else {
tmp_1 = t_0 * (pow((-1.0 / x_46_re), -y_46_re) / t_1);
}
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 < -4.32456490336407124e-19Initial program 35.8
Simplified9.6
Taylor expanded in y.im around 0 4.9
Simplified4.4
if -4.32456490336407124e-19 < y.re < 4.99099794707670522e91Initial program 33.4
Simplified6.7
Taylor expanded in y.re around 0 7.3
if 4.99099794707670522e91 < y.re Initial program 19.2
Simplified20.6
Taylor expanded in x.re around -inf 41.4
Simplified14.8
Final simplification7.0
herbie shell --seed 2021215
(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)))))