\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 -3.108106990901466 \cdot 10^{+219}:\\
\;\;\;\;\frac{-x.im}{\mathsf{hypot}\left(y.im, y.re\right)}\\
\mathbf{elif}\;y.re \le 5.1185396129683884 \cdot 10^{+128}:\\
\;\;\;\;\frac{\frac{x.im \cdot y.re}{\mathsf{hypot}\left(y.im, y.re\right)} - \frac{x.re \cdot y.im}{\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 r2557723 = x_im;
double r2557724 = y_re;
double r2557725 = r2557723 * r2557724;
double r2557726 = x_re;
double r2557727 = y_im;
double r2557728 = r2557726 * r2557727;
double r2557729 = r2557725 - r2557728;
double r2557730 = r2557724 * r2557724;
double r2557731 = r2557727 * r2557727;
double r2557732 = r2557730 + r2557731;
double r2557733 = r2557729 / r2557732;
return r2557733;
}
double f(double x_re, double x_im, double y_re, double y_im) {
double r2557734 = y_re;
double r2557735 = -3.108106990901466e+219;
bool r2557736 = r2557734 <= r2557735;
double r2557737 = x_im;
double r2557738 = -r2557737;
double r2557739 = y_im;
double r2557740 = hypot(r2557739, r2557734);
double r2557741 = r2557738 / r2557740;
double r2557742 = 5.1185396129683884e+128;
bool r2557743 = r2557734 <= r2557742;
double r2557744 = r2557737 * r2557734;
double r2557745 = r2557744 / r2557740;
double r2557746 = x_re;
double r2557747 = r2557746 * r2557739;
double r2557748 = r2557747 / r2557740;
double r2557749 = r2557745 - r2557748;
double r2557750 = r2557749 / r2557740;
double r2557751 = r2557737 / r2557740;
double r2557752 = r2557743 ? r2557750 : r2557751;
double r2557753 = r2557736 ? r2557741 : r2557752;
return r2557753;
}



Bits error versus x.re



Bits error versus x.im



Bits error versus y.re



Bits error versus y.im
Results
if y.re < -3.108106990901466e+219Initial program 42.3
Simplified42.3
rmApplied add-sqr-sqrt42.3
Applied associate-/r*42.3
rmApplied fma-udef42.3
Applied hypot-def42.3
Taylor expanded around -inf 11.6
Simplified11.6
if -3.108106990901466e+219 < y.re < 5.1185396129683884e+128Initial program 22.0
Simplified22.0
rmApplied add-sqr-sqrt22.0
Applied associate-/r*21.9
rmApplied fma-udef21.9
Applied hypot-def21.9
rmApplied fma-udef21.9
Applied hypot-def13.1
rmApplied div-sub13.1
if 5.1185396129683884e+128 < y.re Initial program 41.3
Simplified41.3
rmApplied add-sqr-sqrt41.3
Applied associate-/r*41.3
rmApplied fma-udef41.3
Applied hypot-def41.3
rmApplied fma-udef41.3
Applied hypot-def26.7
Taylor expanded around inf 14.4
Final simplification13.2
herbie shell --seed 2019120 +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))))