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.7452082763940146e-67) || !((((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= -1.191949392464429e-284) || (!(((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= 0.0) && (((double) (((double) (((double) (x * 2.0)) * y)) / ((double) (x - y)))) <= 1.1202517080680182e-97))))) {
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 | 14.9 |
|---|---|
| Target | 0.3 |
| Herbie | 1.4 |
if (/ (* (* x 2.0) y) (- x y)) < -5.74520827639401457e-67 or -1.1919493924644289e-284 < (/ (* (* x 2.0) y) (- x y)) < 0.0 or 1.12025170806801818e-97 < (/ (* (* x 2.0) y) (- x y)) Initial program 27.1
Simplified2.0
if -5.74520827639401457e-67 < (/ (* (* x 2.0) y) (- x y)) < -1.1919493924644289e-284 or 0.0 < (/ (* (* x 2.0) y) (- x y)) < 1.12025170806801818e-97Initial program 0.7
Final simplification1.4
herbie shell --seed 2020192
(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)))