\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 r4067646 = a;
double r4067647 = b;
double r4067648 = c;
double r4067649 = d;
double r4067650 = r4067648 + r4067649;
double r4067651 = r4067647 + r4067650;
double r4067652 = r4067646 + r4067651;
double r4067653 = 2.0;
double r4067654 = r4067652 * r4067653;
return r4067654;
}
double f(double a, double b, double c, double d) {
double r4067655 = 2.0;
double r4067656 = b;
double r4067657 = c;
double r4067658 = r4067656 + r4067657;
double r4067659 = a;
double r4067660 = d;
double r4067661 = r4067659 + r4067660;
double r4067662 = r4067658 + r4067661;
double r4067663 = r4067655 * r4067662;
return r4067663;
}




Bits error versus a




Bits error versus b




Bits error versus c




Bits error versus d
Results
| Original | 3.7 |
|---|---|
| Target | 3.9 |
| 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 2019171 +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))