\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{\frac{x.im \cdot y.re - y.im \cdot x.re}{\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 r2656659 = x_im;
double r2656660 = y_re;
double r2656661 = r2656659 * r2656660;
double r2656662 = x_re;
double r2656663 = y_im;
double r2656664 = r2656662 * r2656663;
double r2656665 = r2656661 - r2656664;
double r2656666 = r2656660 * r2656660;
double r2656667 = r2656663 * r2656663;
double r2656668 = r2656666 + r2656667;
double r2656669 = r2656665 / r2656668;
return r2656669;
}
double f(double x_re, double x_im, double y_re, double y_im) {
double r2656670 = y_re;
double r2656671 = -1.477885392425796e+104;
bool r2656672 = r2656670 <= r2656671;
double r2656673 = x_im;
double r2656674 = y_im;
double r2656675 = hypot(r2656674, r2656670);
double r2656676 = r2656673 / r2656675;
double r2656677 = -r2656676;
double r2656678 = 1.3360538186501758e+147;
bool r2656679 = r2656670 <= r2656678;
double r2656680 = r2656673 * r2656670;
double r2656681 = x_re;
double r2656682 = r2656674 * r2656681;
double r2656683 = r2656680 - r2656682;
double r2656684 = r2656683 / r2656675;
double r2656685 = r2656684 / r2656675;
double r2656686 = r2656679 ? r2656685 : r2656676;
double r2656687 = r2656672 ? r2656677 : r2656686;
return r2656687;
}



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
rmApplied fma-udef39.7
Applied hypot-def27.0
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 fma-udef18.9
Applied hypot-def11.7
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
rmApplied fma-udef42.8
Applied hypot-def27.8
Taylor expanded around inf 14.0
Final simplification12.9
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))))