\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.im \le -1.954211085394229 \cdot 10^{231}:\\
\;\;\;\;\frac{x.re}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\mathbf{elif}\;y.im \le 2.03024456745374313 \cdot 10^{152}:\\
\;\;\;\;\frac{\frac{y.im \cdot x.re}{-\mathsf{hypot}\left(y.re, y.im\right)} - \frac{y.re}{-\mathsf{hypot}\left(y.re, y.im\right)} \cdot x.im}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x.re}{\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 r70605 = x_im;
double r70606 = y_re;
double r70607 = r70605 * r70606;
double r70608 = x_re;
double r70609 = y_im;
double r70610 = r70608 * r70609;
double r70611 = r70607 - r70610;
double r70612 = r70606 * r70606;
double r70613 = r70609 * r70609;
double r70614 = r70612 + r70613;
double r70615 = r70611 / r70614;
return r70615;
}
double f(double x_re, double x_im, double y_re, double y_im) {
double r70616 = y_im;
double r70617 = -1.9542110853942293e+231;
bool r70618 = r70616 <= r70617;
double r70619 = x_re;
double r70620 = y_re;
double r70621 = hypot(r70620, r70616);
double r70622 = r70619 / r70621;
double r70623 = 2.0302445674537431e+152;
bool r70624 = r70616 <= r70623;
double r70625 = r70616 * r70619;
double r70626 = -r70621;
double r70627 = r70625 / r70626;
double r70628 = r70620 / r70626;
double r70629 = x_im;
double r70630 = r70628 * r70629;
double r70631 = r70627 - r70630;
double r70632 = r70631 / r70621;
double r70633 = -r70619;
double r70634 = r70633 / r70621;
double r70635 = r70624 ? r70632 : r70634;
double r70636 = r70618 ? r70622 : r70635;
return r70636;
}



Bits error versus x.re



Bits error versus x.im



Bits error versus y.re



Bits error versus y.im
Results
if y.im < -1.9542110853942293e+231Initial program 41.3
rmApplied add-sqr-sqrt41.3
Applied *-un-lft-identity41.3
Applied times-frac41.3
Simplified41.3
Simplified33.9
rmApplied associate-*r/33.9
Simplified33.9
rmApplied frac-2neg33.9
Simplified33.9
Taylor expanded around -inf 8.0
if -1.9542110853942293e+231 < y.im < 2.0302445674537431e+152Initial program 22.2
rmApplied add-sqr-sqrt22.2
Applied *-un-lft-identity22.2
Applied times-frac22.2
Simplified22.2
Simplified14.1
rmApplied associate-*r/14.1
Simplified14.0
rmApplied frac-2neg14.0
Simplified14.0
rmApplied div-sub14.0
Simplified5.1
if 2.0302445674537431e+152 < y.im Initial program 44.3
rmApplied add-sqr-sqrt44.3
Applied *-un-lft-identity44.3
Applied times-frac44.3
Simplified44.3
Simplified28.6
rmApplied associate-*r/28.6
Simplified28.6
Taylor expanded around 0 13.5
Simplified13.5
Final simplification6.4
herbie shell --seed 2020043 +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))))