\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 -1.0634875567936728 \cdot 10^{-05} \lor \neg \left(\frac{\left(x \cdot 2\right) \cdot y}{x - y} \leq -2.510506970217685 \cdot 10^{-301} \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.064869663315659 \cdot 10^{+54}\right):\\
\;\;\;\;\frac{x \cdot 2}{\frac{x}{y} + -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x \cdot 2\right) \cdot y}{x - y}\\
\end{array}(FPCore (x y) :precision binary64 (/ (* (* x 2.0) y) (- x y)))
(FPCore (x y)
:precision binary64
(if (or (<= (/ (* (* x 2.0) y) (- x y)) -1.0634875567936728e-05)
(not
(or (<= (/ (* (* x 2.0) y) (- x y)) -2.510506970217685e-301)
(and (not (<= (/ (* (* x 2.0) y) (- x y)) 0.0))
(<= (/ (* (* x 2.0) y) (- x y)) 1.064869663315659e+54)))))
(/ (* x 2.0) (+ (/ x y) -1.0))
(/ (* (* x 2.0) y) (- x y))))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))) <= -1.0634875567936728e-05) || !(((((double) (((double) (x * 2.0)) * y)) / ((double) (x - y))) <= -2.510506970217685e-301) || (!((((double) (((double) (x * 2.0)) * y)) / ((double) (x - y))) <= 0.0) && ((((double) (((double) (x * 2.0)) * y)) / ((double) (x - y))) <= 1.064869663315659e+54))))) {
VAR = (((double) (x * 2.0)) / ((double) ((x / y) + -1.0)));
} else {
VAR = (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)));
}
return VAR;
}




Bits error versus x




Bits error versus y
Results
| Original | 14.9 |
|---|---|
| Target | 0.4 |
| Herbie | 0.6 |
if (/ (* (* x 2.0) y) (- x y)) < -1.06348755679367282e-5 or -2.5105069702176851e-301 < (/ (* (* x 2.0) y) (- x y)) < 0.0 or 1.064869663315659e54 < (/ (* (* x 2.0) y) (- x y)) Initial program 43.0
rmApplied associate-/l*0.8
Simplified0.8
if -1.06348755679367282e-5 < (/ (* (* x 2.0) y) (- x y)) < -2.5105069702176851e-301 or 0.0 < (/ (* (* x 2.0) y) (- x y)) < 1.064869663315659e54Initial program 0.5
Final simplification0.6
herbie shell --seed 2020198
(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)))