double code(double x, double y, double z) {
return ((double) (((double) (x * ((double) (y + z)))) / z));
}
double code(double x, double y, double z) {
double VAR;
if (((((double) (((double) (x * ((double) (y + z)))) / z)) <= -1.0941573754303678e+301) || !(((double) (((double) (x * ((double) (y + z)))) / z)) <= -9.191605125197159e+72))) {
VAR = ((double) (x + ((double) (x * ((double) (y / z))))));
} else {
VAR = ((double) (x + ((double) (((double) (x * y)) * ((double) (1.0 / z))))));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.5 |
|---|---|
| Target | 3.0 |
| Herbie | 1.9 |
if (/ (* x (+ y z)) z) < -1.0941573754303678e301 or -9.1916051251971588e72 < (/ (* x (+ y z)) z) Initial program 14.7
Simplified2.2
if -1.0941573754303678e301 < (/ (* x (+ y z)) z) < -9.1916051251971588e72Initial program 0.2
Simplified9.5
rmApplied div-inv9.5
Applied associate-*r*0.2
Final simplification1.9
herbie shell --seed 2020192
(FPCore (x y z)
:name "Numeric.SpecFunctions:choose from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(/ x (/ z (+ y z)))
(/ (* x (+ y z)) z))