\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.47788539242579584930401717666761308705 \cdot 10^{104}:\\
\;\;\;\;\frac{-x.im}{\mathsf{hypot}\left(y.im, y.re\right)}\\
\mathbf{elif}\;y.re \le 1.336053818650175824019993309646752305462 \cdot 10^{147}:\\
\;\;\;\;\frac{\left(x.im \cdot y.re - y.im \cdot x.re\right) \cdot \frac{1}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{\mathsf{hypot}\left(y.im, y.re\right)}\\
\end{array}double f(double x_re, double x_im, double y_re, double y_im) {
double r3087636 = x_im;
double r3087637 = y_re;
double r3087638 = r3087636 * r3087637;
double r3087639 = x_re;
double r3087640 = y_im;
double r3087641 = r3087639 * r3087640;
double r3087642 = r3087638 - r3087641;
double r3087643 = r3087637 * r3087637;
double r3087644 = r3087640 * r3087640;
double r3087645 = r3087643 + r3087644;
double r3087646 = r3087642 / r3087645;
return r3087646;
}
double f(double x_re, double x_im, double y_re, double y_im) {
double r3087647 = y_re;
double r3087648 = -1.477885392425796e+104;
bool r3087649 = r3087647 <= r3087648;
double r3087650 = x_im;
double r3087651 = -r3087650;
double r3087652 = y_im;
double r3087653 = hypot(r3087652, r3087647);
double r3087654 = r3087651 / r3087653;
double r3087655 = 1.3360538186501758e+147;
bool r3087656 = r3087647 <= r3087655;
double r3087657 = r3087650 * r3087647;
double r3087658 = x_re;
double r3087659 = r3087652 * r3087658;
double r3087660 = r3087657 - r3087659;
double r3087661 = 1.0;
double r3087662 = r3087661 / r3087653;
double r3087663 = r3087660 * r3087662;
double r3087664 = r3087663 / r3087653;
double r3087665 = r3087650 / r3087653;
double r3087666 = r3087656 ? r3087664 : r3087665;
double r3087667 = r3087649 ? r3087654 : r3087666;
return r3087667;
}



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.477885392425796e+104Initial program 39.8
Simplified39.8
rmApplied add-sqr-sqrt39.8
Applied associate-/r*39.7
rmApplied fma-udef39.7
Applied hypot-def39.7
Taylor expanded around -inf 16.6
Simplified16.6
if -1.477885392425796e+104 < y.re < 1.3360538186501758e+147Initial program 19.0
Simplified19.0
rmApplied add-sqr-sqrt19.0
Applied associate-/r*18.9
rmApplied fma-udef18.9
Applied hypot-def18.9
rmApplied div-inv19.0
Simplified11.8
if 1.3360538186501758e+147 < y.re Initial program 42.8
Simplified42.8
rmApplied add-sqr-sqrt42.8
Applied associate-/r*42.8
rmApplied fma-udef42.8
Applied hypot-def42.8
Taylor expanded around inf 14.0
Final simplification13.0
herbie shell --seed 2019172 +o rules:numerics
(FPCore (x.re x.im y.re y.im)
:name "_divideComplex, imaginary part"
(/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im))))