\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} = -inf.0:\\
\;\;\;\;\frac{1}{\frac{\frac{x}{y} + -1}{x \cdot 2}}\\
\mathbf{elif}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -2.0846029270717649 \cdot 10^{-303} \lor \neg \left(\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -0.0\right) \land \frac{\left(x \cdot 2\right) \cdot y}{x - y} \le 1.1289622460478969 \cdot 10^{-75}:\\
\;\;\;\;\frac{\left(x \cdot 2\right) \cdot y}{x - y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(2 \cdot \frac{y}{x - y}\right)\\
\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)))) <= -inf.0)) {
VAR = ((double) (1.0 / ((double) (((double) (((double) (x / y)) + -1.0)) / ((double) (x * 2.0))))));
} else {
double VAR_1;
if (((((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= -2.084602927071765e-303) || (!(((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= -0.0) && (((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= 1.128962246047897e-75)))) {
VAR_1 = ((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y))));
} else {
VAR_1 = ((double) (x * ((double) (2.0 * ((double) (y / ((double) (x - y))))))));
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.1 |
|---|---|
| Target | 0.4 |
| Herbie | 0.8 |
if (/ (* (* x 2.0) y) (- x y)) < -inf.0Initial program 64.0
Simplified0.2
rmApplied clear-num0.3
Simplified0.3
rmApplied un-div-inv0.3
Applied associate-*r/0.4
rmApplied clear-num0.6
if -inf.0 < (/ (* (* x 2.0) y) (- x y)) < -2.0846029270717649e-303 or -0.0 < (/ (* (* x 2.0) y) (- x y)) < 1.1289622460478969e-75Initial program 0.6
if -2.0846029270717649e-303 < (/ (* (* x 2.0) y) (- x y)) < -0.0 or 1.1289622460478969e-75 < (/ (* (* x 2.0) y) (- x y)) Initial program 33.7
Simplified1.1
Final simplification0.8
herbie shell --seed 2020185
(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)))