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 <= -12375748977649096.0) || !(y <= 9089537523424004.0))) {
VAR = ((double) (x + ((double) (((double) (x / y)) * ((double) (((double) (1.0 / y)) - 1.0))))));
} else {
VAR = ((double) (1.0 + ((double) (((double) (y * ((double) (x - 1.0)))) / ((double) (y + 1.0))))));
}
return VAR;
}




Bits error versus x




Bits error versus y
Results
| Original | 22.7 |
|---|---|
| Target | 0.2 |
| Herbie | 7.6 |
if y < -12375748977649096 or 9089537523424004 < y Initial program 47.0
Simplified30.1
Taylor expanded around inf 15.4
Simplified15.4
if -12375748977649096 < y < 9089537523424004Initial program 0.6
Final simplification7.6
herbie shell --seed 2020192
(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))))