\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 r3554426 = a;
double r3554427 = b;
double r3554428 = c;
double r3554429 = d;
double r3554430 = r3554428 + r3554429;
double r3554431 = r3554427 + r3554430;
double r3554432 = r3554426 + r3554431;
double r3554433 = 2.0;
double r3554434 = r3554432 * r3554433;
return r3554434;
}
double f(double a, double b, double c, double d) {
double r3554435 = 2.0;
double r3554436 = b;
double r3554437 = c;
double r3554438 = r3554436 + r3554437;
double r3554439 = a;
double r3554440 = d;
double r3554441 = r3554439 + r3554440;
double r3554442 = r3554438 + r3554441;
double r3554443 = r3554435 * r3554442;
return r3554443;
}




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 2019163 +o rules:numerics
(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))