\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}:\\
\;\;\;\;\frac{-1 \cdot x.im}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\mathbf{elif}\;y.re \le 7.04631729015775065 \cdot 10^{128}:\\
\;\;\;\;\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)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\end{array}double f(double x_re, double x_im, double y_re, double y_im) {
double r107520 = x_im;
double r107521 = y_re;
double r107522 = r107520 * r107521;
double r107523 = x_re;
double r107524 = y_im;
double r107525 = r107523 * r107524;
double r107526 = r107522 - r107525;
double r107527 = r107521 * r107521;
double r107528 = r107524 * r107524;
double r107529 = r107527 + r107528;
double r107530 = r107526 / r107529;
return r107530;
}
double f(double x_re, double x_im, double y_re, double y_im) {
double r107531 = y_re;
double r107532 = -1.2498976234817265e+107;
bool r107533 = r107531 <= r107532;
double r107534 = -1.0;
double r107535 = x_im;
double r107536 = r107534 * r107535;
double r107537 = y_im;
double r107538 = hypot(r107531, r107537);
double r107539 = r107536 / r107538;
double r107540 = 7.04631729015775e+128;
bool r107541 = r107531 <= r107540;
double r107542 = r107535 * r107531;
double r107543 = x_re;
double r107544 = r107543 * r107537;
double r107545 = r107542 - r107544;
double r107546 = r107545 / r107538;
double r107547 = 1.0;
double r107548 = r107547 / r107538;
double r107549 = r107546 * r107548;
double r107550 = r107535 / r107538;
double r107551 = r107541 ? r107549 : r107550;
double r107552 = r107533 ? r107539 : r107551;
return r107552;
}



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 associate-*r/26.9
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 associate-*r/11.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 associate-*r/28.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))))