\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{y.re \cdot x.im}{y.im}\\
\mathbf{if}\;y.im \leq -2.0042077319869305 \cdot 10^{+119}:\\
\;\;\;\;\frac{x.re - t_0}{\mathsf{hypot}\left(y.im, y.re\right)}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_1 := \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 -5.572939327178327 \cdot 10^{-201}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y.im \leq 4.677589763324624 \cdot 10^{-96}:\\
\;\;\;\;\frac{x.im}{y.re} - \frac{y.im \cdot x.re}{{y.re}^{2}}\\
\mathbf{elif}\;y.im \leq 8.516845405596207 \cdot 10^{+36}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0 - x.re}{\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
(let* ((t_0 (/ (* y.re x.im) y.im)))
(if (<= y.im -2.0042077319869305e+119)
(/ (- x.re t_0) (hypot y.im y.re))
(let* ((t_1
(/
(/ (- (* y.re x.im) (* y.im x.re)) (hypot y.im y.re))
(hypot y.im y.re))))
(if (<= y.im -5.572939327178327e-201)
t_1
(if (<= y.im 4.677589763324624e-96)
(- (/ x.im y.re) (/ (* y.im x.re) (pow y.re 2.0)))
(if (<= y.im 8.516845405596207e+36)
t_1
(/ (- 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 = (y_46_re * x_46_im) / y_46_im;
double tmp;
if (y_46_im <= -2.0042077319869305e+119) {
tmp = (x_46_re - t_0) / hypot(y_46_im, y_46_re);
} else {
double t_1 = (((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 <= -5.572939327178327e-201) {
tmp_1 = t_1;
} else if (y_46_im <= 4.677589763324624e-96) {
tmp_1 = (x_46_im / y_46_re) - ((y_46_im * x_46_re) / pow(y_46_re, 2.0));
} else if (y_46_im <= 8.516845405596207e+36) {
tmp_1 = t_1;
} else {
tmp_1 = (t_0 - x_46_re) / 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 < -2.00420773198693045e119Initial program 40.7
Simplified40.7
Applied add-sqr-sqrt_binary6440.7
Applied *-un-lft-identity_binary6440.7
Applied times-frac_binary6440.7
Simplified40.7
Simplified27.6
Applied associate-*l/_binary6427.6
Simplified27.6
Taylor expanded in y.im around -inf 12.0
if -2.00420773198693045e119 < y.im < -5.57293932717832668e-201 or 4.6775897633246239e-96 < y.im < 8.5168454055962068e36Initial program 16.6
Simplified16.6
Applied add-sqr-sqrt_binary6416.6
Applied *-un-lft-identity_binary6416.6
Applied times-frac_binary6416.6
Simplified16.6
Simplified11.2
Applied clear-num_binary6411.2
Applied associate-*l/_binary6411.1
Simplified11.0
if -5.57293932717832668e-201 < y.im < 4.6775897633246239e-96Initial program 22.8
Simplified22.8
Taylor expanded in y.re around inf 11.2
if 8.5168454055962068e36 < y.im Initial program 34.6
Simplified34.6
Applied add-sqr-sqrt_binary6434.6
Applied *-un-lft-identity_binary6434.6
Applied times-frac_binary6434.6
Simplified34.6
Simplified23.5
Applied associate-*l/_binary6423.4
Simplified23.4
Taylor expanded in y.im around inf 15.9
Final simplification12.4
herbie shell --seed 2021215
(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))))