\left(a + \left(b + \left(c + d\right)\right)\right) \cdot 2
2 \cdot \left(\left(b + c\right) + \left(a + d\right)\right)
double f(double a, double b, double c, double d) {
double r4048560 = a;
double r4048561 = b;
double r4048562 = c;
double r4048563 = d;
double r4048564 = r4048562 + r4048563;
double r4048565 = r4048561 + r4048564;
double r4048566 = r4048560 + r4048565;
double r4048567 = 2.0;
double r4048568 = r4048566 * r4048567;
return r4048568;
}
double f(double a, double b, double c, double d) {
double r4048569 = 2.0;
double r4048570 = b;
double r4048571 = c;
double r4048572 = r4048570 + r4048571;
double r4048573 = a;
double r4048574 = d;
double r4048575 = r4048573 + r4048574;
double r4048576 = r4048572 + r4048575;
double r4048577 = r4048569 * r4048576;
return r4048577;
}




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 exp-sum1.2
Applied log-prod0.8
Simplified0.5
Simplified0
Final simplification0
herbie shell --seed 2019172 +o rules:numerics
(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))