\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}x.im \cdot \frac{1}{\mathsf{fma}\left(\frac{y.im}{y.re}, y.im, y.re\right)} - \frac{x.re}{\mathsf{fma}\left(\frac{y.re}{y.im}, y.re, y.im\right)}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) {
return ((x_46_im * (1.0 / fma((y_46_im / y_46_re), y_46_im, y_46_re))) - (x_46_re / fma((y_46_re / y_46_im), y_46_re, y_46_im)));
}



Bits error versus x.re



Bits error versus x.im



Bits error versus y.re



Bits error versus y.im
Results
Initial program 26.0
rmApplied div-sub26.0
Simplified24.8
Simplified23.2
Taylor expanded around 0 15.7
Simplified14.0
Taylor expanded around 0 5.7
Simplified3.3
rmApplied div-inv3.4
Final simplification3.4
herbie shell --seed 2020071 +o rules:numerics
(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))))