\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} \leq -8785164387162626:\\
\;\;\;\;x \cdot \left(2 \cdot \frac{y}{x - y}\right)\\
\mathbf{elif}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} \leq -2.5085564572307417 \cdot 10^{-306} \lor \neg \left(\frac{\left(x \cdot 2\right) \cdot y}{x - y} \leq -0\right) \land \frac{\left(x \cdot 2\right) \cdot y}{x - y} \leq 1.3079517994419901 \cdot 10^{-98}:\\
\;\;\;\;\frac{\left(x \cdot 2\right) \cdot y}{x - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 2}{\frac{x}{y} + -1}\\
\end{array}double code(double x, double y) {
return (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)));
}
double code(double x, double y) {
double VAR;
if (((((double) (((double) (x * 2.0)) * y)) / ((double) (x - y))) <= -8785164387162626.0)) {
VAR = ((double) (x * ((double) (2.0 * (y / ((double) (x - y)))))));
} else {
double VAR_1;
if ((((((double) (((double) (x * 2.0)) * y)) / ((double) (x - y))) <= -2.5085564572307417e-306) || (!((((double) (((double) (x * 2.0)) * y)) / ((double) (x - y))) <= -0.0) && ((((double) (((double) (x * 2.0)) * y)) / ((double) (x - y))) <= 1.3079517994419901e-98)))) {
VAR_1 = (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)));
} else {
VAR_1 = (((double) (x * 2.0)) / ((double) ((x / y) + -1.0)));
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.0 |
|---|---|
| Target | 0.4 |
| Herbie | 0.8 |
if (/ (* (* x 2.0) y) (- x y)) < -8785164387162626Initial program Error: 35.5 bits
SimplifiedError: 0.2 bits
if -8785164387162626 < (/ (* (* x 2.0) y) (- x y)) < -2.50855645723074173e-306 or -0.0 < (/ (* (* x 2.0) y) (- x y)) < 1.3079517994419901e-98Initial program Error: 0.5 bits
if -2.50855645723074173e-306 < (/ (* (* x 2.0) y) (- x y)) < -0.0 or 1.3079517994419901e-98 < (/ (* (* x 2.0) y) (- x y)) Initial program Error: 32.3 bits
rmApplied associate-/l*Error: 1.4 bits
SimplifiedError: 1.4 bits
Final simplificationError: 0.8 bits
herbie shell --seed 2020200
(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)))