\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 -9.27892827186840393 \cdot 10^{168}:\\
\;\;\;\;\frac{-1 \cdot x.im}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\mathbf{elif}\;y.re \le 3.77234305398194677 \cdot 10^{-85}:\\
\;\;\;\;\frac{\frac{x.im \cdot y.re - x.re \cdot y.im}{\mathsf{hypot}\left(y.re, y.im\right)}}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\mathbf{elif}\;y.re \le 3.6837815617052844 \cdot 10^{85}:\\
\;\;\;\;\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 9.05878189337241501 \cdot 10^{204}:\\
\;\;\;\;\frac{\frac{x.im \cdot y.re - x.re \cdot y.im}{\mathsf{hypot}\left(y.re, y.im\right)}}{\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 <= -9.278928271868404e+168)) {
VAR = ((double) (((double) (-1.0 * x_46_im)) / ((double) hypot(y_46_re, y_46_im))));
} else {
double VAR_1;
if ((y_46_re <= 3.772343053981947e-85)) {
VAR_1 = ((double) (((double) (((double) (((double) (x_46_im * y_46_re)) - ((double) (x_46_re * y_46_im)))) / ((double) hypot(y_46_re, y_46_im)))) / ((double) hypot(y_46_re, y_46_im))));
} else {
double VAR_2;
if ((y_46_re <= 3.6837815617052844e+85)) {
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 <= 9.058781893372415e+204)) {
VAR_3 = ((double) (((double) (((double) (((double) (x_46_im * y_46_re)) - ((double) (x_46_re * y_46_im)))) / ((double) hypot(y_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 < -9.278928271868404e+168Initial program 44.1
rmApplied add-sqr-sqrt44.1
Applied *-un-lft-identity44.1
Applied times-frac44.1
Simplified44.1
Simplified29.8
rmApplied associate-*r/29.8
Simplified29.8
Taylor expanded around -inf 13.5
if -9.278928271868404e+168 < y.re < 3.772343053981947e-85 or 3.6837815617052844e+85 < y.re < 9.058781893372415e+204Initial program 22.6
rmApplied add-sqr-sqrt22.6
Applied *-un-lft-identity22.6
Applied times-frac22.6
Simplified22.6
Simplified13.7
rmApplied associate-*r/13.6
Simplified13.5
if 3.772343053981947e-85 < y.re < 3.6837815617052844e+85Initial program 16.6
rmApplied div-sub16.6
Simplified14.7
Simplified12.5
if 9.058781893372415e+204 < y.re Initial program 41.9
rmApplied add-sqr-sqrt41.9
Applied *-un-lft-identity41.9
Applied times-frac41.9
Simplified41.9
Simplified30.8
rmApplied associate-*r/30.8
Simplified30.8
Taylor expanded around inf 11.0
Final simplification13.1
herbie shell --seed 2020120 +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))))