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 -1.1726548595085616 \cdot 10^{+39}:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{{x.re}^{2} + {x.im}^{2}}\right)} \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(t_0\right)\right)\\
\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 -1.1726548595085616e+39)
(* (exp (* y.re (log (sqrt (+ (pow x.re 2.0) (pow x.im 2.0)))))) t_0)
(*
(/ (pow (hypot x.re x.im) y.re) (exp (* y.im (atan2 x.im x.re))))
(expm1 (log1p t_0))))))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 <= -1.1726548595085616e+39) {
tmp = exp(y_46_re * log(sqrt(pow(x_46_re, 2.0) + pow(x_46_im, 2.0)))) * t_0;
} else {
tmp = (pow(hypot(x_46_re, x_46_im), y_46_re) / exp(y_46_im * atan2(x_46_im, x_46_re))) * expm1(log1p(t_0));
}
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 < -1.17265485950856164e39Initial program 36.1
Simplified10.2
Taylor expanded in y.im around 0 2.2
if -1.17265485950856164e39 < y.re Initial program 32.7
Simplified8.3
Applied expm1-log1p-u_binary648.3
Final simplification6.8
herbie shell --seed 2021313
(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)))))