\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 -7.729339549361261 \cdot 10^{+115}:\\
\;\;\;\;-\frac{x.im}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\mathbf{elif}\;y.re \le 1.512622379546738 \cdot 10^{+155}:\\
\;\;\;\;\frac{\frac{x.im \cdot y.re - y.im \cdot x.re}{\mathsf{hypot}\left(y.re, y.im\right)}}{\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 r1988803 = x_im;
double r1988804 = y_re;
double r1988805 = r1988803 * r1988804;
double r1988806 = x_re;
double r1988807 = y_im;
double r1988808 = r1988806 * r1988807;
double r1988809 = r1988805 - r1988808;
double r1988810 = r1988804 * r1988804;
double r1988811 = r1988807 * r1988807;
double r1988812 = r1988810 + r1988811;
double r1988813 = r1988809 / r1988812;
return r1988813;
}
double f(double x_re, double x_im, double y_re, double y_im) {
double r1988814 = y_re;
double r1988815 = -7.729339549361261e+115;
bool r1988816 = r1988814 <= r1988815;
double r1988817 = x_im;
double r1988818 = y_im;
double r1988819 = hypot(r1988814, r1988818);
double r1988820 = r1988817 / r1988819;
double r1988821 = -r1988820;
double r1988822 = 1.512622379546738e+155;
bool r1988823 = r1988814 <= r1988822;
double r1988824 = r1988817 * r1988814;
double r1988825 = x_re;
double r1988826 = r1988818 * r1988825;
double r1988827 = r1988824 - r1988826;
double r1988828 = r1988827 / r1988819;
double r1988829 = r1988828 / r1988819;
double r1988830 = r1988823 ? r1988829 : r1988820;
double r1988831 = r1988816 ? r1988821 : r1988830;
return r1988831;
}



Bits error versus x.re



Bits error versus x.im



Bits error versus y.re



Bits error versus y.im
Results
if y.re < -7.729339549361261e+115Initial program 40.9
rmApplied add-sqr-sqrt40.9
Applied associate-/r*40.9
rmApplied hypot-def40.9
rmApplied hypot-def26.5
Taylor expanded around -inf 15.5
Simplified15.5
if -7.729339549361261e+115 < y.re < 1.512622379546738e+155Initial program 18.5
rmApplied add-sqr-sqrt18.5
Applied associate-/r*18.4
rmApplied hypot-def18.4
rmApplied hypot-def11.4
Taylor expanded around inf 11.4
if 1.512622379546738e+155 < y.re Initial program 45.9
rmApplied add-sqr-sqrt45.9
Applied associate-/r*45.9
rmApplied hypot-def45.9
rmApplied hypot-def27.9
Taylor expanded around inf 15.7
Final simplification12.6
herbie shell --seed 2019162 +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))))