\left(a + \left(b + \left(c + d\right)\right)\right) \cdot 2
2 \cdot \left(\left(b + c\right) + \left(d + a\right)\right)
double f(double a, double b, double c, double d) {
double r4941435 = a;
double r4941436 = b;
double r4941437 = c;
double r4941438 = d;
double r4941439 = r4941437 + r4941438;
double r4941440 = r4941436 + r4941439;
double r4941441 = r4941435 + r4941440;
double r4941442 = 2.0;
double r4941443 = r4941441 * r4941442;
return r4941443;
}
double f(double a, double b, double c, double d) {
double r4941444 = 2.0;
double r4941445 = b;
double r4941446 = c;
double r4941447 = r4941445 + r4941446;
double r4941448 = d;
double r4941449 = a;
double r4941450 = r4941448 + r4941449;
double r4941451 = r4941447 + r4941450;
double r4941452 = r4941444 * r4941451;
return r4941452;
}




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 associate-+r+2.8
rmApplied add-log-exp2.8
Applied add-log-exp2.8
Applied add-log-exp2.8
Applied sum-log2.8
Applied sum-log2.8
Applied add-log-exp2.8
Applied sum-log1.5
Simplified0.9
rmApplied rem-log-exp0
Final simplification0
herbie shell --seed 2019172
(FPCore (a b c d)
:name "Expression, p6"
:pre (and (<= -14.0 a -13.0) (<= -3.0 b -2.0) (<= 3.0 c 3.5) (<= 12.5 d 13.5))
:herbie-target
(+ (* (+ a b) 2.0) (* (+ c d) 2.0))
(* (+ a (+ b (+ c d))) 2.0))