\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 -5.1870879849634226 \cdot 10^{+219}:\\
\;\;\;\;\frac{-x.im}{\mathsf{hypot}\left(y.im, y.re\right)}\\
\mathbf{elif}\;y.re \le 9.416337464243763 \cdot 10^{+96}:\\
\;\;\;\;\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 r1854362 = x_im;
double r1854363 = y_re;
double r1854364 = r1854362 * r1854363;
double r1854365 = x_re;
double r1854366 = y_im;
double r1854367 = r1854365 * r1854366;
double r1854368 = r1854364 - r1854367;
double r1854369 = r1854363 * r1854363;
double r1854370 = r1854366 * r1854366;
double r1854371 = r1854369 + r1854370;
double r1854372 = r1854368 / r1854371;
return r1854372;
}
double f(double x_re, double x_im, double y_re, double y_im) {
double r1854373 = y_re;
double r1854374 = -5.1870879849634226e+219;
bool r1854375 = r1854373 <= r1854374;
double r1854376 = x_im;
double r1854377 = -r1854376;
double r1854378 = y_im;
double r1854379 = hypot(r1854378, r1854373);
double r1854380 = r1854377 / r1854379;
double r1854381 = 9.416337464243763e+96;
bool r1854382 = r1854373 <= r1854381;
double r1854383 = 1.0;
double r1854384 = r1854376 * r1854373;
double r1854385 = x_re;
double r1854386 = r1854385 * r1854378;
double r1854387 = r1854384 - r1854386;
double r1854388 = r1854379 / r1854387;
double r1854389 = r1854383 / r1854388;
double r1854390 = r1854389 / r1854379;
double r1854391 = r1854376 / r1854379;
double r1854392 = r1854382 ? r1854390 : r1854391;
double r1854393 = r1854375 ? r1854380 : r1854392;
return r1854393;
}



Bits error versus x.re



Bits error versus x.im



Bits error versus y.re



Bits error versus y.im
Results
if y.re < -5.1870879849634226e+219Initial program 41.7
Simplified41.7
rmApplied add-sqr-sqrt41.7
Applied associate-/r*41.7
rmApplied fma-udef41.7
Applied hypot-def41.7
rmApplied fma-udef41.7
Applied hypot-def31.5
Taylor expanded around -inf 9.9
Simplified9.9
if -5.1870879849634226e+219 < y.re < 9.416337464243763e+96Initial program 20.9
Simplified20.9
rmApplied add-sqr-sqrt21.0
Applied associate-/r*20.9
rmApplied fma-udef20.9
Applied hypot-def20.9
rmApplied fma-udef20.9
Applied hypot-def12.6
rmApplied *-un-lft-identity12.6
Applied associate-/l*12.7
if 9.416337464243763e+96 < y.re Initial program 39.2
Simplified39.2
rmApplied add-sqr-sqrt39.2
Applied associate-/r*39.1
rmApplied fma-udef39.1
Applied hypot-def39.1
rmApplied fma-udef39.1
Applied hypot-def25.6
Taylor expanded around inf 17.1
Final simplification13.3
herbie shell --seed 2019149 +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))))