\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 -5.1227572413769072 \cdot 10^{95}:\\
\;\;\;\;\frac{-1 \cdot x.im}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\mathbf{elif}\;y.re \le 6.69895789485502902 \cdot 10^{-106}:\\
\;\;\;\;\frac{\frac{1}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{x.im \cdot y.re - x.re \cdot y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\mathbf{elif}\;y.re \le 2.54946443013026016 \cdot 10^{79}:\\
\;\;\;\;\frac{x.im}{\frac{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}{y.re}} - \frac{x.re}{\frac{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}{y.im}}\\
\mathbf{elif}\;y.re \le 4.6230231189603044 \cdot 10^{141}:\\
\;\;\;\;\frac{\frac{1}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{x.im \cdot y.re - x.re \cdot y.im}}}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\end{array}double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((double) (((double) (((double) (x_46_im * y_46_re)) - ((double) (x_46_re * y_46_im)))) / ((double) (((double) (y_46_re * y_46_re)) + ((double) (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 VAR;
if ((y_46_re <= -5.122757241376907e+95)) {
VAR = ((double) (((double) (-1.0 * x_46_im)) / ((double) hypot(y_46_re, y_46_im))));
} else {
double VAR_1;
if ((y_46_re <= 6.698957894855029e-106)) {
VAR_1 = ((double) (((double) (1.0 / ((double) (((double) hypot(y_46_re, y_46_im)) / ((double) (((double) (x_46_im * y_46_re)) - ((double) (x_46_re * y_46_im)))))))) / ((double) hypot(y_46_re, y_46_im))));
} else {
double VAR_2;
if ((y_46_re <= 2.54946443013026e+79)) {
VAR_2 = ((double) (((double) (x_46_im / ((double) (((double) fma(y_46_re, y_46_re, ((double) (y_46_im * y_46_im)))) / y_46_re)))) - ((double) (x_46_re / ((double) (((double) fma(y_46_re, y_46_re, ((double) (y_46_im * y_46_im)))) / y_46_im))))));
} else {
double VAR_3;
if ((y_46_re <= 4.6230231189603044e+141)) {
VAR_3 = ((double) (((double) (1.0 / ((double) (((double) hypot(y_46_re, y_46_im)) / ((double) (((double) (x_46_im * y_46_re)) - ((double) (x_46_re * y_46_im)))))))) / ((double) hypot(y_46_re, y_46_im))));
} else {
VAR_3 = ((double) (x_46_im / ((double) hypot(y_46_re, y_46_im))));
}
VAR_2 = VAR_3;
}
VAR_1 = VAR_2;
}
VAR = VAR_1;
}
return VAR;
}



Bits error versus x.re



Bits error versus x.im



Bits error versus y.re



Bits error versus y.im
Results
if y.re < -5.122757241376907e+95Initial program 39.9
rmApplied add-sqr-sqrt39.9
Applied *-un-lft-identity39.9
Applied times-frac39.9
Simplified39.9
Simplified27.7
rmApplied associate-*r/27.7
Simplified27.6
Taylor expanded around -inf 15.3
if -5.122757241376907e+95 < y.re < 6.698957894855029e-106 or 2.54946443013026e+79 < y.re < 4.6230231189603044e+141Initial program 20.0
rmApplied add-sqr-sqrt20.0
Applied *-un-lft-identity20.0
Applied times-frac20.1
Simplified20.1
Simplified12.4
rmApplied associate-*r/12.3
Simplified12.3
rmApplied clear-num12.3
if 6.698957894855029e-106 < y.re < 2.54946443013026e+79Initial program 15.7
rmApplied div-sub15.7
Simplified14.4
Simplified11.8
if 4.6230231189603044e+141 < y.re Initial program 44.2
rmApplied add-sqr-sqrt44.2
Applied *-un-lft-identity44.2
Applied times-frac44.2
Simplified44.2
Simplified28.3
rmApplied associate-*r/28.2
Simplified28.2
Taylor expanded around inf 13.3
Final simplification12.9
herbie shell --seed 2020121 +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))))