\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -1.54048815934693065 \cdot 10^{-18} \lor \neg \left(\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -2.17408644625624733 \cdot 10^{-304} \lor \neg \left(\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le 5.0368410606991103 \cdot 10^{-306}\right) \land \frac{\left(x \cdot 2\right) \cdot y}{x - y} \le 2.13149732853840599 \cdot 10^{-112}\right):\\
\;\;\;\;x \cdot \left(2 \cdot \frac{y}{x - y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x \cdot 2\right) \cdot y}{x - y}\\
\end{array}double code(double x, double y) {
return ((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y))));
}
double code(double x, double y) {
double VAR;
if (((((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= -1.5404881593469307e-18) || !((((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= -2.1740864462562473e-304) || (!(((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= 5.03684106069911e-306) && (((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= 2.131497328538406e-112))))) {
VAR = ((double) (x * ((double) (2.0 * ((double) (y / ((double) (x - y))))))));
} else {
VAR = ((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y))));
}
return VAR;
}




Bits error versus x




Bits error versus y
Results
| Original | 14.6 |
|---|---|
| Target | 0.3 |
| Herbie | 1.0 |
if (/ (* (* x 2.0) y) (- x y)) < -1.54048815934693065e-18 or -2.17408644625624733e-304 < (/ (* (* x 2.0) y) (- x y)) < 5.0368410606991103e-306 or 2.13149732853840599e-112 < (/ (* (* x 2.0) y) (- x y)) Initial program 30.0
Simplified1.3
if -1.54048815934693065e-18 < (/ (* (* x 2.0) y) (- x y)) < -2.17408644625624733e-304 or 5.0368410606991103e-306 < (/ (* (* x 2.0) y) (- x y)) < 2.13149732853840599e-112Initial program 0.7
Final simplification1.0
herbie shell --seed 2020184
(FPCore (x y)
:name "Linear.Projection:perspective from linear-1.19.1.3, B"
:precision binary64
:herbie-target
(if (< x -1.7210442634149447e+81) (* (/ (* 2.0 x) (- x y)) y) (if (< x 8.364504563556443e+16) (/ (* x 2.0) (/ (- x y) y)) (* (/ (* 2.0 x) (- x y)) y)))
(/ (* (* x 2.0) y) (- x y)))