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)))) <= -5.99497389826133e+109) || !((((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= -5.256781878331156e-306) || (!(((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= -0.0) && (((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= 1.4978900967011268e-27))))) {
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 | 15.4 |
|---|---|
| Target | 0.3 |
| Herbie | 0.6 |
if (/ (* (* x 2.0) y) (- x y)) < -5.99497389826132983e109 or -5.2567818783311559e-306 < (/ (* (* x 2.0) y) (- x y)) < -0.0 or 1.4978900967011268e-27 < (/ (* (* x 2.0) y) (- x y)) Initial program 44.9
Simplified0.4
if -5.99497389826132983e109 < (/ (* (* x 2.0) y) (- x y)) < -5.2567818783311559e-306 or -0.0 < (/ (* (* x 2.0) y) (- x y)) < 1.4978900967011268e-27Initial program 0.6
Final simplification0.6
herbie shell --seed 2020181
(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)))