\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.47788539242579584930401717666761308705 \cdot 10^{104}:\\
\;\;\;\;\frac{-x.im}{\mathsf{hypot}\left(y.im, y.re\right)}\\
\mathbf{elif}\;y.re \le 1.336053818650175824019993309646752305462 \cdot 10^{147}:\\
\;\;\;\;\frac{\left(x.im \cdot y.re - y.im \cdot x.re\right) \cdot \frac{1}{\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 r3595225 = x_im;
double r3595226 = y_re;
double r3595227 = r3595225 * r3595226;
double r3595228 = x_re;
double r3595229 = y_im;
double r3595230 = r3595228 * r3595229;
double r3595231 = r3595227 - r3595230;
double r3595232 = r3595226 * r3595226;
double r3595233 = r3595229 * r3595229;
double r3595234 = r3595232 + r3595233;
double r3595235 = r3595231 / r3595234;
return r3595235;
}
double f(double x_re, double x_im, double y_re, double y_im) {
double r3595236 = y_re;
double r3595237 = -1.477885392425796e+104;
bool r3595238 = r3595236 <= r3595237;
double r3595239 = x_im;
double r3595240 = -r3595239;
double r3595241 = y_im;
double r3595242 = hypot(r3595241, r3595236);
double r3595243 = r3595240 / r3595242;
double r3595244 = 1.3360538186501758e+147;
bool r3595245 = r3595236 <= r3595244;
double r3595246 = r3595239 * r3595236;
double r3595247 = x_re;
double r3595248 = r3595241 * r3595247;
double r3595249 = r3595246 - r3595248;
double r3595250 = 1.0;
double r3595251 = r3595250 / r3595242;
double r3595252 = r3595249 * r3595251;
double r3595253 = r3595252 / r3595242;
double r3595254 = r3595239 / r3595242;
double r3595255 = r3595245 ? r3595253 : r3595254;
double r3595256 = r3595238 ? r3595243 : r3595255;
return r3595256;
}



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.477885392425796e+104Initial program 39.8
Simplified39.8
rmApplied add-sqr-sqrt39.8
Applied associate-/r*39.7
rmApplied fma-udef39.7
Applied hypot-def39.7
Taylor expanded around -inf 16.6
Simplified16.6
if -1.477885392425796e+104 < y.re < 1.3360538186501758e+147Initial program 19.0
Simplified19.0
rmApplied add-sqr-sqrt19.0
Applied associate-/r*18.9
rmApplied fma-udef18.9
Applied hypot-def18.9
rmApplied div-inv19.0
Simplified11.8
if 1.3360538186501758e+147 < y.re Initial program 42.8
Simplified42.8
rmApplied add-sqr-sqrt42.8
Applied associate-/r*42.8
rmApplied fma-udef42.8
Applied hypot-def42.8
Taylor expanded around inf 14.0
Final simplification13.0
herbie shell --seed 2019172 +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))))