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}\;x.im \leq -1.3615886409990095 \cdot 10^{+154}:\\
\;\;\;\;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(y.im \cdot \log \left(\frac{{x.re}^{2}}{x.im} \cdot -0.5 - x.im\right) + y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{elif}\;x.im \leq -1.0743541222776415 \cdot 10^{-198}:\\
\;\;\;\;e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\right)} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} + \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im\right)\\
\mathbf{elif}\;x.im \leq -2.141753005128826 \cdot 10^{-242}:\\
\;\;\;\;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(y.im \cdot \log \left(\frac{{x.re}^{2}}{x.im} \cdot -0.5 - x.im\right) + y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{elif}\;x.im \leq 6.423284817288334 \cdot 10^{-188}:\\
\;\;\;\;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 \left(\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \log \left(\sqrt{{x.re}^{2} + {x.im}^{2}}\right) \cdot \left(y.im \cdot \sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;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(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} + y.im \cdot \log \left(x.im + \frac{{x.re}^{2}}{x.im} \cdot 0.5\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)))
(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 (<= x.im -1.3615886409990095e+154)
(*
(exp
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(* (atan2 x.im x.re) y.im)))
(cos
(+
(* y.im (log (- (* (/ (pow x.re 2.0) x.im) -0.5) x.im)))
(* y.re (atan2 x.im x.re)))))
(if (<= x.im -1.0743541222776415e-198)
(*
(exp
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(*
(cbrt (* (atan2 x.im x.re) y.im))
(*
(cbrt (* (atan2 x.im x.re) y.im))
(cbrt (* (atan2 x.im x.re) y.im))))))
(cos
(+
(* y.re (atan2 x.im x.re))
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im))))
(if (<= x.im -2.141753005128826e-242)
(*
(exp
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(* (atan2 x.im x.re) y.im)))
(cos
(+
(* y.im (log (- (* (/ (pow x.re 2.0) x.im) -0.5) x.im)))
(* y.re (atan2 x.im x.re)))))
(if (<= x.im 6.423284817288334e-188)
(*
(exp
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(* (atan2 x.im x.re) y.im)))
(-
(cos (* y.re (atan2 x.im x.re)))
(*
(log (sqrt (+ (pow x.re 2.0) (pow x.im 2.0))))
(* y.im (sin (* y.re (atan2 x.im x.re)))))))
(*
(exp
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(* (atan2 x.im x.re) y.im)))
(cos
(+
(* y.re (atan2 x.im x.re))
(* y.im (log (+ x.im (* (/ (pow x.re 2.0) x.im) 0.5))))))))))))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 (x_46_im <= -1.3615886409990095e+154) {
tmp = 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((y_46_im * log(((pow(x_46_re, 2.0) / x_46_im) * -0.5) - x_46_im)) + (y_46_re * atan2(x_46_im, x_46_re)));
} else if (x_46_im <= -1.0743541222776415e-198) {
tmp = exp((log(sqrt((x_46_re * x_46_re) + (x_46_im * x_46_im))) * y_46_re) - (cbrt(atan2(x_46_im, x_46_re) * y_46_im) * (cbrt(atan2(x_46_im, x_46_re) * y_46_im) * cbrt(atan2(x_46_im, x_46_re) * y_46_im)))) * cos((y_46_re * atan2(x_46_im, x_46_re)) + (log(sqrt((x_46_re * x_46_re) + (x_46_im * x_46_im))) * y_46_im));
} else if (x_46_im <= -2.141753005128826e-242) {
tmp = 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((y_46_im * log(((pow(x_46_re, 2.0) / x_46_im) * -0.5) - x_46_im)) + (y_46_re * atan2(x_46_im, x_46_re)));
} else if (x_46_im <= 6.423284817288334e-188) {
tmp = 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(y_46_re * atan2(x_46_im, x_46_re)) - (log(sqrt(pow(x_46_re, 2.0) + pow(x_46_im, 2.0))) * (y_46_im * sin(y_46_re * atan2(x_46_im, x_46_re)))));
} else {
tmp = 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((y_46_re * atan2(x_46_im, x_46_re)) + (y_46_im * log(x_46_im + ((pow(x_46_re, 2.0) / x_46_im) * 0.5))));
}
return tmp;
}



Bits error versus x.re



Bits error versus x.im



Bits error versus y.re



Bits error versus y.im
Results
if x.im < -1.3615886409990095e154 or -1.0743541222776415e-198 < x.im < -2.141753005128826e-242Initial program 57.5
Taylor expanded around -inf 39.4
Simplified39.4
if -1.3615886409990095e154 < x.im < -1.0743541222776415e-198Initial program 18.7
rmApplied add-cube-cbrt_binary6418.7
Simplified18.7
Simplified18.7
if -2.141753005128826e-242 < x.im < 6.42328481728833444e-188Initial program 36.0
Taylor expanded around 0 36.4
Simplified36.3
if 6.42328481728833444e-188 < x.im Initial program 33.9
Taylor expanded around 0 28.3
Simplified28.3
Final simplification28.7
herbie shell --seed 2020339
(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)))))