\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 -0.416635959786448:\\
\;\;\;\;\frac{x \cdot 2}{\frac{x}{y} + -1}\\
\mathbf{elif}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} \leq -1.7867097684673947 \cdot 10^{-301}:\\
\;\;\;\;\frac{\left(x \cdot 2\right) \cdot y}{x - y}\\
\mathbf{elif}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} \leq -0:\\
\;\;\;\;x \cdot \left(2 \cdot \frac{y}{x - y}\right)\\
\mathbf{elif}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} \leq 2.0921875714989711 \cdot 10^{-81}:\\
\;\;\;\;\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))) <= -0.416635959786448)) {
VAR = (((double) (x * 2.0)) / ((double) ((x / y) + -1.0)));
} else {
double VAR_1;
if (((((double) (((double) (x * 2.0)) * y)) / ((double) (x - y))) <= -1.7867097684673947e-301)) {
VAR_1 = (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)));
} else {
double VAR_2;
if (((((double) (((double) (x * 2.0)) * y)) / ((double) (x - y))) <= -0.0)) {
VAR_2 = ((double) (x * ((double) (2.0 * (y / ((double) (x - y)))))));
} else {
double VAR_3;
if (((((double) (((double) (x * 2.0)) * y)) / ((double) (x - y))) <= 2.0921875714989711e-81)) {
VAR_3 = (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)));
} else {
VAR_3 = (((double) (x * 2.0)) / ((double) ((x / y) + -1.0)));
}
VAR_2 = VAR_3;
}
VAR_1 = VAR_2;
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.2 |
|---|---|
| Target | 0.3 |
| Herbie | 0.9 |
if (/ (* (* x 2.0) y) (- x y)) < -0.416635959786448018 or 2.09218757149897114e-81 < (/ (* (* x 2.0) y) (- x y)) Initial program 25.2
rmApplied associate-/l*1.0
Simplified1.0
if -0.416635959786448018 < (/ (* (* x 2.0) y) (- x y)) < -1.7867097684673947e-301 or -0.0 < (/ (* (* x 2.0) y) (- x y)) < 2.09218757149897114e-81Initial program 0.7
if -1.7867097684673947e-301 < (/ (* (* x 2.0) y) (- x y)) < -0.0Initial program 56.1
Simplified1.4
Final simplification0.9
herbie shell --seed 2020196
(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)))