\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}\;y.re \leq -2.7839182926984815 \cdot 10^{+79}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{elif}\;y.re \leq -8.849808015292707 \cdot 10^{-110}:\\
\;\;\;\;\frac{\frac{y.re \cdot x.re + x.im \cdot y.im}{\sqrt{{y.re}^{2} + {y.im}^{2}}}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\\
\mathbf{elif}\;y.re \leq 2.1472644582174967 \cdot 10^{-123}:\\
\;\;\;\;\frac{x.im}{y.im} + \frac{y.re \cdot x.re}{{y.im}^{2}}\\
\mathbf{elif}\;y.re \leq 1.315316451044619 \cdot 10^{+86}:\\
\;\;\;\;\frac{\frac{y.re \cdot x.re + x.im \cdot y.im}{\sqrt{{y.re}^{2} + {y.im}^{2}}}}{\sqrt{y.re \cdot y.re + y.im \cdot y.im}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re}{y.re} + \frac{x.im \cdot y.im}{{y.re}^{2}}\\
\end{array}(FPCore (x.re x.im y.re y.im) :precision binary64 (/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im))))
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -2.7839182926984815e+79)
(/ x.re y.re)
(if (<= y.re -8.849808015292707e-110)
(/
(/
(+ (* y.re x.re) (* x.im y.im))
(sqrt (+ (pow y.re 2.0) (pow y.im 2.0))))
(sqrt (+ (* y.re y.re) (* y.im y.im))))
(if (<= y.re 2.1472644582174967e-123)
(+ (/ x.im y.im) (/ (* y.re x.re) (pow y.im 2.0)))
(if (<= y.re 1.315316451044619e+86)
(/
(/
(+ (* y.re x.re) (* x.im y.im))
(sqrt (+ (pow y.re 2.0) (pow y.im 2.0))))
(sqrt (+ (* y.re y.re) (* y.im y.im))))
(+ (/ x.re y.re) (/ (* x.im y.im) (pow y.re 2.0))))))))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 tmp;
if (y_46_re <= -2.7839182926984815e+79) {
tmp = x_46_re / y_46_re;
} else if (y_46_re <= -8.849808015292707e-110) {
tmp = (((y_46_re * x_46_re) + (x_46_im * y_46_im)) / sqrt(pow(y_46_re, 2.0) + pow(y_46_im, 2.0))) / sqrt((y_46_re * y_46_re) + (y_46_im * y_46_im));
} else if (y_46_re <= 2.1472644582174967e-123) {
tmp = (x_46_im / y_46_im) + ((y_46_re * x_46_re) / pow(y_46_im, 2.0));
} else if (y_46_re <= 1.315316451044619e+86) {
tmp = (((y_46_re * x_46_re) + (x_46_im * y_46_im)) / sqrt(pow(y_46_re, 2.0) + pow(y_46_im, 2.0))) / sqrt((y_46_re * y_46_re) + (y_46_im * y_46_im));
} else {
tmp = (x_46_re / y_46_re) + ((x_46_im * y_46_im) / pow(y_46_re, 2.0));
}
return tmp;
}












Bits error versus x.re












Bits error versus x.im












Bits error versus y.re












Bits error versus y.im
Results
| Alternative 1 | |
|---|---|
| Error | 14.3 |
| Cost | 15044 |
| Alternative 2 | |
|---|---|
| Error | 14.4 |
| Cost | 8324 |
| Alternative 3 | |
|---|---|
| Error | 14.4 |
| Cost | 8003 |
| Alternative 4 | |
|---|---|
| Error | 15.9 |
| Cost | 2244 |
| Alternative 5 | |
|---|---|
| Error | 22.0 |
| Cost | 1988 |
| Alternative 6 | |
|---|---|
| Error | 23.7 |
| Cost | 785 |
| Alternative 7 | |
|---|---|
| Error | 35.3 |
| Cost | 513 |
| Alternative 8 | |
|---|---|
| Error | 52.3 |
| Cost | 64 |
| Alternative 9 | |
|---|---|
| Error | 61.7 |
| Cost | 64 |

if y.re < -2.7839182926984815e79Initial program 39.7
Taylor expanded around inf 17.5
Simplified17.5
if -2.7839182926984815e79 < y.re < -8.84980801529270659e-110 or 2.1472644582174967e-123 < y.re < 1.3153164510446189e86Initial program 15.0
rmApplied add-sqr-sqrt_binary64_146415.0
Applied associate-/r*_binary64_138614.9
Simplified14.9
Simplified14.9
if -8.84980801529270659e-110 < y.re < 2.1472644582174967e-123Initial program 21.1
Taylor expanded around 0 10.5
Simplified10.5
Simplified10.5
if 1.3153164510446189e86 < y.re Initial program 38.5
Taylor expanded around inf 15.6
Simplified15.6
Simplified15.6
Final simplification14.3
herbie shell --seed 2021044
(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))))