\left(a + \left(b + \left(c + d\right)\right)\right) \cdot 2
2 \cdot \left(\left(\left(a + d\right) + c\right) + b\right)
double f(double a, double b, double c, double d) {
double r3352282 = a;
double r3352283 = b;
double r3352284 = c;
double r3352285 = d;
double r3352286 = r3352284 + r3352285;
double r3352287 = r3352283 + r3352286;
double r3352288 = r3352282 + r3352287;
double r3352289 = 2.0;
double r3352290 = r3352288 * r3352289;
return r3352290;
}
double f(double a, double b, double c, double d) {
double r3352291 = 2.0;
double r3352292 = a;
double r3352293 = d;
double r3352294 = r3352292 + r3352293;
double r3352295 = c;
double r3352296 = r3352294 + r3352295;
double r3352297 = b;
double r3352298 = r3352296 + r3352297;
double r3352299 = r3352291 * r3352298;
return r3352299;
}




Bits error versus a




Bits error versus b




Bits error versus c




Bits error versus d
Results
| Original | 3.7 |
|---|---|
| Target | 3.8 |
| Herbie | 0 |
Initial program 3.7
rmApplied add-log-exp3.7
Applied add-log-exp3.7
Applied sum-log3.7
Applied add-log-exp3.7
Applied sum-log2.8
Applied add-log-exp2.8
Applied sum-log1.5
Simplified0.9
rmApplied rem-log-exp0.0
rmApplied associate-+l+0
Final simplification0
herbie shell --seed 2019151
(FPCore (a b c d)
:name "Expression, p6"
:pre (and (<= -14 a -13) (<= -3 b -2) (<= 3 c 3.5) (<= 12.5 d 13.5))
:herbie-target
(+ (* (+ a b) 2) (* (+ c d) 2))
(* (+ a (+ b (+ c d))) 2))