\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.4037038847053747 \cdot 10^{+154}:\\
\;\;\;\;\frac{-x.im}{\mathsf{hypot}\left(y.im, y.re\right)}\\
\mathbf{elif}\;y.re \le 1.8584161242035747 \cdot 10^{+93}:\\
\;\;\;\;\frac{\frac{1}{\frac{\mathsf{hypot}\left(y.im, y.re\right)}{x.im \cdot y.re - x.re \cdot y.im}}}{\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 r1177612 = x_im;
double r1177613 = y_re;
double r1177614 = r1177612 * r1177613;
double r1177615 = x_re;
double r1177616 = y_im;
double r1177617 = r1177615 * r1177616;
double r1177618 = r1177614 - r1177617;
double r1177619 = r1177613 * r1177613;
double r1177620 = r1177616 * r1177616;
double r1177621 = r1177619 + r1177620;
double r1177622 = r1177618 / r1177621;
return r1177622;
}
double f(double x_re, double x_im, double y_re, double y_im) {
double r1177623 = y_re;
double r1177624 = -1.4037038847053747e+154;
bool r1177625 = r1177623 <= r1177624;
double r1177626 = x_im;
double r1177627 = -r1177626;
double r1177628 = y_im;
double r1177629 = hypot(r1177628, r1177623);
double r1177630 = r1177627 / r1177629;
double r1177631 = 1.8584161242035747e+93;
bool r1177632 = r1177623 <= r1177631;
double r1177633 = 1.0;
double r1177634 = r1177626 * r1177623;
double r1177635 = x_re;
double r1177636 = r1177635 * r1177628;
double r1177637 = r1177634 - r1177636;
double r1177638 = r1177629 / r1177637;
double r1177639 = r1177633 / r1177638;
double r1177640 = r1177639 / r1177629;
double r1177641 = r1177626 / r1177629;
double r1177642 = r1177632 ? r1177640 : r1177641;
double r1177643 = r1177625 ? r1177630 : r1177642;
return r1177643;
}



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.4037038847053747e+154Initial program 43.9
Simplified43.9
rmApplied add-sqr-sqrt43.9
Applied associate-/r*43.9
rmApplied fma-udef43.9
Applied hypot-def43.9
rmApplied fma-udef43.9
Applied hypot-def27.1
Taylor expanded around -inf 13.2
Simplified13.2
if -1.4037038847053747e+154 < y.re < 1.8584161242035747e+93Initial program 18.9
Simplified18.9
rmApplied add-sqr-sqrt18.9
Applied associate-/r*18.8
rmApplied fma-udef18.8
Applied hypot-def18.8
rmApplied fma-udef18.8
Applied hypot-def11.7
rmApplied *-un-lft-identity11.7
Applied associate-/l*11.8
if 1.8584161242035747e+93 < y.re Initial program 37.5
Simplified37.5
rmApplied add-sqr-sqrt37.5
Applied associate-/r*37.5
rmApplied fma-udef37.5
Applied hypot-def37.5
rmApplied fma-udef37.5
Applied hypot-def24.3
Taylor expanded around inf 15.9
Final simplification12.8
herbie shell --seed 2019151 +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))))