\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.im \leq -3.9892431633599146 \cdot 10^{+89}:\\
\;\;\;\;\frac{x.re - \frac{y.re \cdot x.im}{y.im}}{\mathsf{hypot}\left(y.im, y.re\right)}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_0 := \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.im \leq -4.902684341493697 \cdot 10^{-194}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y.im \leq 1.2501679329591383 \cdot 10^{-70}:\\
\;\;\;\;\frac{x.im}{y.re} - \frac{y.im \cdot x.re}{y.re \cdot y.re}\\
\mathbf{elif}\;y.im \leq 2.5508280192928966 \cdot 10^{+145}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x.re \cdot \frac{-1}{\mathsf{hypot}\left(y.im, y.re\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
(if (<= y.im -3.9892431633599146e+89)
(/ (- x.re (/ (* y.re x.im) y.im)) (hypot y.im y.re))
(let* ((t_0
(/
(/ (- (* y.re x.im) (* y.im x.re)) (hypot y.im y.re))
(hypot y.im y.re))))
(if (<= y.im -4.902684341493697e-194)
t_0
(if (<= y.im 1.2501679329591383e-70)
(- (/ x.im y.re) (/ (* y.im x.re) (* y.re y.re)))
(if (<= y.im 2.5508280192928966e+145)
t_0
(* x.re (/ -1.0 (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 tmp;
if (y_46_im <= -3.9892431633599146e+89) {
tmp = (x_46_re - ((y_46_re * x_46_im) / y_46_im)) / hypot(y_46_im, y_46_re);
} else {
double t_0 = (((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_im <= -4.902684341493697e-194) {
tmp_1 = t_0;
} else if (y_46_im <= 1.2501679329591383e-70) {
tmp_1 = (x_46_im / y_46_re) - ((y_46_im * x_46_re) / (y_46_re * y_46_re));
} else if (y_46_im <= 2.5508280192928966e+145) {
tmp_1 = t_0;
} else {
tmp_1 = x_46_re * (-1.0 / hypot(y_46_im, y_46_re));
}
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 < -3.9892431633599146e89Initial program 37.5
Simplified37.5
Applied add-sqr-sqrt_binary6437.5
Applied *-un-lft-identity_binary6437.5
Applied times-frac_binary6437.5
Simplified37.5
Simplified24.2
Applied associate-*l/_binary6424.2
Simplified24.2
Taylor expanded in y.im around -inf 11.4
if -3.9892431633599146e89 < y.im < -4.902684341493697e-194 or 1.2501679329591383e-70 < y.im < 2.5508280192928966e145Initial program 17.3
Simplified17.3
Applied add-sqr-sqrt_binary6417.3
Applied *-un-lft-identity_binary6417.3
Applied times-frac_binary6417.3
Simplified17.3
Simplified11.4
Applied associate-*l/_binary6411.3
Simplified11.3
if -4.902684341493697e-194 < y.im < 1.2501679329591383e-70Initial program 19.2
Simplified19.2
Taylor expanded in y.re around inf 11.9
Simplified11.9
if 2.5508280192928966e145 < y.im Initial program 42.9
Simplified42.9
Applied add-sqr-sqrt_binary6442.9
Applied *-un-lft-identity_binary6442.9
Applied times-frac_binary6442.9
Simplified42.9
Simplified26.9
Taylor expanded in y.re around 0 13.9
Simplified13.9
Final simplification11.8
herbie shell --seed 2022067
(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))))