\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\begin{array}{l}
\mathbf{if}\;y.re \le -1.24989762348172646 \cdot 10^{107}:\\
\;\;\;\;{\left(\frac{-1 \cdot x.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)}^{1}\\
\mathbf{elif}\;y.re \le 7.04631729015775065 \cdot 10^{128}:\\
\;\;\;\;{\left(\frac{x.im \cdot y.re - x.re \cdot y.im}{\mathsf{hypot}\left(y.re, y.im\right)} \cdot \frac{1}{\mathsf{hypot}\left(y.re, y.im\right)}\right)}^{1}\\
\mathbf{else}:\\
\;\;\;\;{\left(\frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}\right)}^{1}\\
\end{array}double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return (((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)));
}
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double temp;
if ((y_46_re <= -1.2498976234817265e+107)) {
temp = pow(((-1.0 * x_46_im) / hypot(y_46_re, y_46_im)), 1.0);
} else {
double temp_1;
if ((y_46_re <= 7.04631729015775e+128)) {
temp_1 = pow(((((x_46_im * y_46_re) - (x_46_re * y_46_im)) / hypot(y_46_re, y_46_im)) * (1.0 / hypot(y_46_re, y_46_im))), 1.0);
} else {
temp_1 = pow((x_46_im / hypot(y_46_re, y_46_im)), 1.0);
}
temp = temp_1;
}
return temp;
}



Bits error versus x.re



Bits error versus x.im



Bits error versus y.re



Bits error versus y.im
Results
if y.re < -1.2498976234817265e+107Initial program 40.3
rmApplied add-sqr-sqrt40.3
Applied *-un-lft-identity40.3
Applied times-frac40.3
Simplified40.3
Simplified27.0
rmApplied pow127.0
Applied pow127.0
Applied pow-prod-down27.0
Simplified26.9
Taylor expanded around -inf 16.4
if -1.2498976234817265e+107 < y.re < 7.04631729015775e+128Initial program 18.7
rmApplied add-sqr-sqrt18.7
Applied *-un-lft-identity18.7
Applied times-frac18.7
Simplified18.7
Simplified11.9
rmApplied pow111.9
Applied pow111.9
Applied pow-prod-down11.9
Simplified11.7
rmApplied div-inv11.9
if 7.04631729015775e+128 < y.re Initial program 42.0
rmApplied add-sqr-sqrt42.0
Applied *-un-lft-identity42.0
Applied times-frac42.0
Simplified42.0
Simplified28.1
rmApplied pow128.1
Applied pow128.1
Applied pow-prod-down28.1
Simplified28.0
Taylor expanded around inf 15.0
Final simplification13.2
herbie shell --seed 2020065 +o rules:numerics
(FPCore (x.re x.im y.re y.im)
:name "_divideComplex, imaginary part"
:precision binary64
(/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im))))