\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.0689057415946615 \cdot 10^{65}:\\
\;\;\;\;\frac{-1 \cdot x.im}{\mathsf{hypot}\left(y.re, y.im\right)}\\
\mathbf{elif}\;y.re \le 1.5910699936696656 \cdot 10^{174}:\\
\;\;\;\;1 \cdot \frac{\frac{x.im \cdot y.re - x.re \cdot y.im}{\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 r133914 = x_im;
double r133915 = y_re;
double r133916 = r133914 * r133915;
double r133917 = x_re;
double r133918 = y_im;
double r133919 = r133917 * r133918;
double r133920 = r133916 - r133919;
double r133921 = r133915 * r133915;
double r133922 = r133918 * r133918;
double r133923 = r133921 + r133922;
double r133924 = r133920 / r133923;
return r133924;
}
double f(double x_re, double x_im, double y_re, double y_im) {
double r133925 = y_re;
double r133926 = -1.0689057415946615e+65;
bool r133927 = r133925 <= r133926;
double r133928 = -1.0;
double r133929 = x_im;
double r133930 = r133928 * r133929;
double r133931 = y_im;
double r133932 = hypot(r133925, r133931);
double r133933 = r133930 / r133932;
double r133934 = 1.5910699936696656e+174;
bool r133935 = r133925 <= r133934;
double r133936 = 1.0;
double r133937 = r133929 * r133925;
double r133938 = x_re;
double r133939 = r133938 * r133931;
double r133940 = r133937 - r133939;
double r133941 = r133940 / r133932;
double r133942 = r133941 / r133932;
double r133943 = r133936 * r133942;
double r133944 = r133929 / r133932;
double r133945 = r133935 ? r133943 : r133944;
double r133946 = r133927 ? r133933 : r133945;
return r133946;
}



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.0689057415946615e+65Initial program 36.6
rmApplied add-sqr-sqrt36.6
Applied *-un-lft-identity36.6
Applied times-frac36.6
Simplified36.6
Simplified24.6
rmApplied associate-*r/24.5
Simplified24.5
Taylor expanded around -inf 18.3
if -1.0689057415946615e+65 < y.re < 1.5910699936696656e+174Initial program 19.4
rmApplied add-sqr-sqrt19.4
Applied *-un-lft-identity19.4
Applied times-frac19.4
Simplified19.4
Simplified12.3
rmApplied associate-*r/12.3
Simplified12.2
rmApplied clear-num12.3
rmApplied *-un-lft-identity12.3
Applied *-un-lft-identity12.3
Applied *-un-lft-identity12.3
Applied times-frac12.3
Applied add-sqr-sqrt12.3
Applied times-frac12.3
Applied times-frac12.3
Simplified12.3
Simplified12.2
if 1.5910699936696656e+174 < y.re Initial program 46.2
rmApplied add-sqr-sqrt46.2
Applied *-un-lft-identity46.2
Applied times-frac46.2
Simplified46.2
Simplified33.7
rmApplied associate-*r/33.7
Simplified33.7
Taylor expanded around inf 12.8
Final simplification13.6
herbie shell --seed 2020024 +o rules:numerics
(FPCore (x.re x.im y.re y.im)
:name "_divideComplex, imaginary part"
:precision binary64
(/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im))))