double code(double x, double y) {
return ((double) (1.0 - ((double) (((double) (((double) (1.0 - x)) * y)) / ((double) (y + 1.0))))));
}
double code(double x, double y) {
double VAR;
if (((y <= -8.804440934020806e+30) || !(y <= 5.5750201166678655e+20))) {
VAR = ((double) (x + ((double) (((double) (x / y)) * ((double) (((double) (1.0 / y)) - 1.0))))));
} else {
VAR = ((double) (1.0 + ((double) (((double) (y * ((double) (((double) (x - 1.0)) / ((double) (((double) (1.0 * 1.0)) - ((double) (y * y)))))))) * ((double) (1.0 - y))))));
}
return VAR;
}




Bits error versus x




Bits error versus y
Results
| Original | 22.5 |
|---|---|
| Target | 0.2 |
| Herbie | 7.3 |
if y < -8.804440934020806e30 or 557502011666786550000 < y Initial program 47.2
Simplified29.6
Taylor expanded around inf 14.1
Simplified14.1
if -8.804440934020806e30 < y < 557502011666786550000Initial program 1.6
Simplified1.5
rmApplied flip-+1.5
Applied associate-/r/1.5
Applied associate-*r*1.5
Final simplification7.3
herbie shell --seed 2020180
(FPCore (x y)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, D"
:precision binary64
:herbie-target
(if (< y -3693.8482788297247) (- (/ 1.0 y) (- (/ x y) x)) (if (< y 6799310503.41891) (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))) (- (/ 1.0 y) (- (/ x y) x))))
(- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))))