\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\begin{array}{l}
\mathbf{if}\;\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \le 3.220575316160926 \cdot 10^{304}:\\
\;\;\;\;\frac{\left(x.re \cdot y.re + x.im \cdot y.im\right) \cdot \frac{1}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\\
\end{array}double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return (((x_46_re * y_46_re) + (x_46_im * 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 VAR;
if (((((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))) <= 3.220575316160926e+304)) {
VAR = ((((x_46_re * y_46_re) + (x_46_im * y_46_im)) * (1.0 / sqrt(((y_46_re * y_46_re) + (y_46_im * y_46_im))))) / sqrt(((y_46_re * y_46_re) + (y_46_im * y_46_im))));
} else {
VAR = (x_46_im / sqrt(((y_46_re * y_46_re) + (y_46_im * y_46_im))));
}
return VAR;
}



Bits error versus x.re



Bits error versus x.im



Bits error versus y.re



Bits error versus y.im
Results
if (/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im))) < 3.220575316160926e+304Initial program 13.9
rmApplied add-sqr-sqrt13.9
Applied associate-/r*13.8
rmApplied div-inv13.9
if 3.220575316160926e+304 < (/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im))) Initial program 63.8
rmApplied add-sqr-sqrt63.8
Applied associate-/r*63.8
Taylor expanded around 0 60.0
Final simplification25.1
herbie shell --seed 2020105
(FPCore (x.re x.im y.re y.im)
:name "_divideComplex, real part"
:precision binary64
(/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im))))