\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
\begin{array}{l}
t_0 := \frac{1}{\mathsf{hypot}\left(y.im, y.re\right)}\\
t_1 := \frac{y.im \cdot x.re}{y.re}\\
\mathbf{if}\;y.re \leq -3.6431575460204783 \cdot 10^{+168}:\\
\;\;\;\;t_0 \cdot \left(t_1 - x.im\right)\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_2 := \frac{\frac{y.re \cdot x.im - y.im \cdot x.re}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}\\
\mathbf{if}\;y.re \leq -4.650305513891855 \cdot 10^{-126}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y.re \leq 1.184468592590644 \cdot 10^{-129}:\\
\;\;\;\;\frac{y.re \cdot x.im}{y.im \cdot y.im} - \frac{x.re}{y.im}\\
\mathbf{elif}\;y.re \leq 2.4176762365015643 \cdot 10^{+126}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(x.im - t_1\right)\\
\end{array}\\
\end{array}
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im))))
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ 1.0 (hypot y.im y.re))) (t_1 (/ (* y.im x.re) y.re)))
(if (<= y.re -3.6431575460204783e+168)
(* t_0 (- t_1 x.im))
(let* ((t_2
(/
(/ (- (* y.re x.im) (* y.im x.re)) (hypot y.im y.re))
(hypot y.im y.re))))
(if (<= y.re -4.650305513891855e-126)
t_2
(if (<= y.re 1.184468592590644e-129)
(- (/ (* y.re x.im) (* y.im y.im)) (/ x.re y.im))
(if (<= y.re 2.4176762365015643e+126)
t_2
(* t_0 (- x.im t_1)))))))))double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = 1.0 / hypot(y_46_im, y_46_re);
double t_1 = (y_46_im * x_46_re) / y_46_re;
double tmp;
if (y_46_re <= -3.6431575460204783e+168) {
tmp = t_0 * (t_1 - x_46_im);
} else {
double t_2 = (((y_46_re * x_46_im) - (y_46_im * x_46_re)) / hypot(y_46_im, y_46_re)) / hypot(y_46_im, y_46_re);
double tmp_1;
if (y_46_re <= -4.650305513891855e-126) {
tmp_1 = t_2;
} else if (y_46_re <= 1.184468592590644e-129) {
tmp_1 = ((y_46_re * x_46_im) / (y_46_im * y_46_im)) - (x_46_re / y_46_im);
} else if (y_46_re <= 2.4176762365015643e+126) {
tmp_1 = t_2;
} else {
tmp_1 = t_0 * (x_46_im - t_1);
}
tmp = tmp_1;
}
return tmp;
}



Bits error versus x.re



Bits error versus x.im



Bits error versus y.re



Bits error versus y.im
Results
if y.re < -3.6431575460204783e168Initial program 45.0
Applied add-sqr-sqrt_binary6445.0
Applied *-un-lft-identity_binary6445.0
Applied times-frac_binary6445.0
Simplified45.0
Simplified29.3
Taylor expanded in y.re around -inf 11.3
if -3.6431575460204783e168 < y.re < -4.65030551389185485e-126 or 1.18446859259064399e-129 < y.re < 2.4176762365015643e126Initial program 18.1
Applied add-sqr-sqrt_binary6418.1
Applied *-un-lft-identity_binary6418.1
Applied times-frac_binary6418.1
Simplified18.1
Simplified13.0
Applied associate-*l/_binary6412.9
if -4.65030551389185485e-126 < y.re < 1.18446859259064399e-129Initial program 24.0
Applied add-sqr-sqrt_binary6424.0
Applied *-un-lft-identity_binary6424.0
Applied times-frac_binary6424.0
Simplified24.0
Simplified13.1
Applied *-un-lft-identity_binary6413.1
Applied associate-*l*_binary6413.1
Simplified24.0
Taylor expanded in y.re around 0 10.4
Simplified10.4
if 2.4176762365015643e126 < y.re Initial program 42.7
Applied add-sqr-sqrt_binary6442.7
Applied *-un-lft-identity_binary6442.7
Applied times-frac_binary6442.7
Simplified42.7
Simplified29.2
Taylor expanded in y.re around inf 13.9
Final simplification12.2
herbie shell --seed 2022068
(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))))