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)))) <= -1.1864643416555227e-17) || !((((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= -3.468798690241185e-306) || (!(((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= -0.0) && (((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= 8.057782803603935e-39))))) {
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.3 |
|---|---|
| Target | 0.4 |
| Herbie | 0.5 |
if (/ (* (* x 2.0) y) (- x y)) < -1.1864643416555227e-17 or -3.46879869024118526e-306 < (/ (* (* x 2.0) y) (- x y)) < -0.0 or 8.05778280360393456e-39 < (/ (* (* x 2.0) y) (- x y)) Initial program 35.7
Simplified0.3
if -1.1864643416555227e-17 < (/ (* (* x 2.0) y) (- x y)) < -3.46879869024118526e-306 or -0.0 < (/ (* (* x 2.0) y) (- x y)) < 8.05778280360393456e-39Initial program 0.6
Final simplification0.5
herbie shell --seed 2020190
(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)))