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}
\mathbf{if}\;y.im \leq -1.8408802784809857 \cdot 10^{-05}:\\
\;\;\;\;0\\
\mathbf{elif}\;y.im \leq -1.8917662554192892 \cdot 10^{-44}:\\
\;\;\;\;1\\
\mathbf{elif}\;y.im \leq -2.196245806719985 \cdot 10^{-193}:\\
\;\;\;\;e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{elif}\;y.im \leq 6.98163160565977 \cdot 10^{-21}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\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
(if (<= y.im -1.8408802784809857e-05)
0.0
(if (<= y.im -1.8917662554192892e-44)
1.0
(if (<= y.im -2.196245806719985e-193)
(*
(exp
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(* y.im (atan2 x.im x.re))))
(cos (* y.re (atan2 x.im x.re))))
(if (<= y.im 6.98163160565977e-21) 1.0 0.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)) * 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 tmp;
if (y_46_im <= -1.8408802784809857e-05) {
tmp = 0.0;
} else if (y_46_im <= -1.8917662554192892e-44) {
tmp = 1.0;
} else if (y_46_im <= -2.196245806719985e-193) {
tmp = exp((log(sqrt((x_46_re * x_46_re) + (x_46_im * x_46_im))) * y_46_re) - (y_46_im * atan2(x_46_im, x_46_re))) * cos(y_46_re * atan2(x_46_im, x_46_re));
} else if (y_46_im <= 6.98163160565977e-21) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}



Bits error versus x.re



Bits error versus x.im



Bits error versus y.re



Bits error versus y.im
Results
if y.im < -1.8408802784809857e-5 or 6.9816316056597699e-21 < y.im Initial program 11.4
if -1.8408802784809857e-5 < y.im < -1.89176625541928917e-44 or -2.1962458067199849e-193 < y.im < 6.9816316056597699e-21Initial program 21.8
if -1.89176625541928917e-44 < y.im < -2.1962458067199849e-193Initial program 32.6
Taylor expanded around 0 21.3
Final simplification17.1
herbie shell --seed 2021091
(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)))))