\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.01458341645274 \cdot 10^{+165}:\\
\;\;\;\;\frac{-x.im}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\mathbf{elif}\;y.re \le 2.0408764461888536 \cdot 10^{+156}:\\
\;\;\;\;\frac{\frac{1}{\frac{\mathsf{hypot}\left(y.re, y.im\right)}{x.im \cdot y.re - x.re \cdot y.im}}}{\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 r4882295 = x_im;
double r4882296 = y_re;
double r4882297 = r4882295 * r4882296;
double r4882298 = x_re;
double r4882299 = y_im;
double r4882300 = r4882298 * r4882299;
double r4882301 = r4882297 - r4882300;
double r4882302 = r4882296 * r4882296;
double r4882303 = r4882299 * r4882299;
double r4882304 = r4882302 + r4882303;
double r4882305 = r4882301 / r4882304;
return r4882305;
}
double f(double x_re, double x_im, double y_re, double y_im) {
double r4882306 = y_re;
double r4882307 = -1.01458341645274e+165;
bool r4882308 = r4882306 <= r4882307;
double r4882309 = x_im;
double r4882310 = -r4882309;
double r4882311 = y_im;
double r4882312 = hypot(r4882306, r4882311);
double r4882313 = r4882310 / r4882312;
double r4882314 = 2.0408764461888536e+156;
bool r4882315 = r4882306 <= r4882314;
double r4882316 = 1.0;
double r4882317 = r4882309 * r4882306;
double r4882318 = x_re;
double r4882319 = r4882318 * r4882311;
double r4882320 = r4882317 - r4882319;
double r4882321 = r4882312 / r4882320;
double r4882322 = r4882316 / r4882321;
double r4882323 = r4882322 / r4882312;
double r4882324 = r4882309 / r4882312;
double r4882325 = r4882315 ? r4882323 : r4882324;
double r4882326 = r4882308 ? r4882313 : r4882325;
return r4882326;
}



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.01458341645274e+165Initial program 44.3
rmApplied add-sqr-sqrt44.3
Applied associate-/r*44.3
rmApplied fma-neg44.3
rmApplied hypot-def44.3
Taylor expanded around -inf 12.7
Simplified12.7
if -1.01458341645274e+165 < y.re < 2.0408764461888536e+156Initial program 19.6
rmApplied add-sqr-sqrt19.6
Applied associate-/r*19.5
rmApplied fma-neg19.5
rmApplied hypot-def19.5
rmApplied clear-num19.6
Simplified12.6
if 2.0408764461888536e+156 < y.re Initial program 44.7
rmApplied add-sqr-sqrt44.7
Applied associate-/r*44.7
rmApplied fma-neg44.7
rmApplied hypot-def44.7
Taylor expanded around inf 14.0
Final simplification12.8
herbie shell --seed 2019128 +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))))