\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 := x.im \cdot y.re - x.re \cdot y.im\\
t_1 := \frac{t_0}{y.re \cdot y.re + y.im \cdot y.im}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;\frac{x.im}{y.re}\\
\mathbf{elif}\;t_1 \leq 7.916655966912562 \cdot 10^{+295}:\\
\;\;\;\;\frac{\frac{t_0}{\mathsf{hypot}\left(y.im, y.re\right)}}{\mathsf{hypot}\left(y.im, y.re\right)}\\
\mathbf{else}:\\
\;\;\;\;-\frac{x.re}{y.im}\\
\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) (* x.re y.im)))
(t_1 (/ t_0 (+ (* y.re y.re) (* y.im y.im)))))
(if (<= t_1 (- INFINITY))
(/ x.im y.re)
(if (<= t_1 7.916655966912562e+295)
(/ (/ t_0 (hypot y.im y.re)) (hypot y.im y.re))
(- (/ x.re y.im))))))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) - (x_46_re * y_46_im);
double t_1 = t_0 / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = x_46_im / y_46_re;
} else if (t_1 <= 7.916655966912562e+295) {
tmp = (t_0 / hypot(y_46_im, y_46_re)) / hypot(y_46_im, y_46_re);
} else {
tmp = -(x_46_re / y_46_im);
}
return tmp;
}



Bits error versus x.re



Bits error versus x.im



Bits error versus y.re



Bits error versus y.im
Results
if (/.f64 (-.f64 (*.f64 x.im y.re) (*.f64 x.re y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) < -inf.0Initial program 64.0
Simplified64.0
Taylor expanded in y.re around inf 36.8
if -inf.0 < (/.f64 (-.f64 (*.f64 x.im y.re) (*.f64 x.re y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) < 7.9166559669125623e295Initial program 11.7
Simplified11.7
Applied add-sqr-sqrt_binary6411.7
Applied *-un-lft-identity_binary6411.7
Applied times-frac_binary6411.7
Simplified11.7
Simplified0.7
Applied associate-*l/_binary640.6
if 7.9166559669125623e295 < (/.f64 (-.f64 (*.f64 x.im y.re) (*.f64 x.re y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) Initial program 63.1
Simplified63.1
Taylor expanded in y.re around 0 35.6
Simplified35.6
Final simplification10.4
herbie shell --seed 2022081
(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))))