\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{x.im \cdot y.re}{y.im}\\
\mathbf{if}\;y.im \leq -1.0001347671923885 \cdot 10^{+180}:\\
\;\;\;\;\frac{x.re - t_0}{\mathsf{hypot}\left(y.im, y.re\right)}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_1 := x.im \cdot y.re - y.im \cdot x.re\\
t_2 := \frac{\frac{t_1}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}\\
\mathbf{if}\;y.im \leq -1.0719267080027835 \cdot 10^{-77}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_3 := \frac{x.im}{y.re} - \frac{y.im \cdot x.re}{y.re \cdot y.re}\\
\mathbf{if}\;y.im \leq -2.3624307415395805 \cdot 10^{-197}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;y.im \leq -7.746052639847127 \cdot 10^{-223}:\\
\;\;\;\;\frac{\frac{1}{\mathsf{hypot}\left(y.im, y.re\right)}}{\frac{\mathsf{hypot}\left(y.im, y.re\right)}{t_1}}\\
\mathbf{elif}\;y.im \leq -8.168380286508774 \cdot 10^{-280}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;y.im \leq 2.6508181390370694 \cdot 10^{+133}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0 - x.re}{\mathsf{hypot}\left(y.im, y.re\right)}\\
\end{array}\\
\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 (/ (* x.im y.re) y.im)))
(if (<= y.im -1.0001347671923885e+180)
(/ (- x.re t_0) (hypot y.im y.re))
(let* ((t_1 (- (* x.im y.re) (* y.im x.re)))
(t_2 (/ (/ t_1 (hypot y.im y.re)) (hypot y.im y.re))))
(if (<= y.im -1.0719267080027835e-77)
t_2
(let* ((t_3 (- (/ x.im y.re) (/ (* y.im x.re) (* y.re y.re)))))
(if (<= y.im -2.3624307415395805e-197)
t_3
(if (<= y.im -7.746052639847127e-223)
(/ (/ 1.0 (hypot y.im y.re)) (/ (hypot y.im y.re) t_1))
(if (<= y.im -8.168380286508774e-280)
t_3
(if (<= y.im 2.6508181390370694e+133)
t_2
(/ (- t_0 x.re) (hypot y.im y.re))))))))))))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 = (x_46_im * y_46_re) / y_46_im;
double tmp;
if (y_46_im <= -1.0001347671923885e+180) {
tmp = (x_46_re - t_0) / hypot(y_46_im, y_46_re);
} else {
double t_1 = (x_46_im * y_46_re) - (y_46_im * x_46_re);
double t_2 = (t_1 / hypot(y_46_im, y_46_re)) / hypot(y_46_im, y_46_re);
double tmp_1;
if (y_46_im <= -1.0719267080027835e-77) {
tmp_1 = t_2;
} else {
double t_3 = (x_46_im / y_46_re) - ((y_46_im * x_46_re) / (y_46_re * y_46_re));
double tmp_2;
if (y_46_im <= -2.3624307415395805e-197) {
tmp_2 = t_3;
} else if (y_46_im <= -7.746052639847127e-223) {
tmp_2 = (1.0 / hypot(y_46_im, y_46_re)) / (hypot(y_46_im, y_46_re) / t_1);
} else if (y_46_im <= -8.168380286508774e-280) {
tmp_2 = t_3;
} else if (y_46_im <= 2.6508181390370694e+133) {
tmp_2 = t_2;
} else {
tmp_2 = (t_0 - x_46_re) / hypot(y_46_im, y_46_re);
}
tmp_1 = tmp_2;
}
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.im < -1.00013476719238851e180Initial program 42.5
Simplified42.5
Applied add-sqr-sqrt_binary6442.5
Applied *-un-lft-identity_binary6442.5
Applied times-frac_binary6442.5
Simplified42.5
Simplified28.4
Applied associate-*l/_binary6428.4
Simplified28.4
Applied clear-num_binary6428.4
Taylor expanded in y.im around -inf 9.6
Simplified9.6
if -1.00013476719238851e180 < y.im < -1.0719267080027835e-77 or -8.1683802865087739e-280 < y.im < 2.6508181390370694e133Initial program 19.1
Simplified19.1
Applied add-sqr-sqrt_binary6419.1
Applied *-un-lft-identity_binary6419.1
Applied times-frac_binary6419.1
Simplified19.1
Simplified12.0
Applied associate-*l/_binary6411.9
Simplified11.9
Applied *-un-lft-identity_binary6411.9
if -1.0719267080027835e-77 < y.im < -2.3624307415395805e-197 or -7.74605263984712723e-223 < y.im < -8.1683802865087739e-280Initial program 16.0
Simplified16.0
Applied add-sqr-sqrt_binary6416.0
Applied *-un-lft-identity_binary6416.0
Applied times-frac_binary6416.0
Simplified16.0
Simplified8.8
Applied associate-*l/_binary648.7
Simplified8.7
Taylor expanded in y.re around inf 12.8
Simplified12.8
if -2.3624307415395805e-197 < y.im < -7.74605263984712723e-223Initial program 20.0
Simplified20.0
Applied add-sqr-sqrt_binary6420.0
Applied *-un-lft-identity_binary6420.0
Applied times-frac_binary6420.0
Simplified20.0
Simplified8.8
Applied associate-*l/_binary648.7
Simplified8.7
Applied clear-num_binary648.8
Applied associate-/r/_binary648.8
Applied associate-/l*_binary648.8
if 2.6508181390370694e133 < y.im Initial program 40.7
Simplified40.7
Applied add-sqr-sqrt_binary6440.7
Applied *-un-lft-identity_binary6440.7
Applied times-frac_binary6440.7
Simplified40.7
Simplified26.1
Applied associate-*l/_binary6426.0
Simplified26.0
Taylor expanded in y.re around 0 11.9
Final simplification11.7
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))))