\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 r2700517 = a;
double r2700518 = b;
double r2700519 = c;
double r2700520 = d;
double r2700521 = r2700519 + r2700520;
double r2700522 = r2700518 + r2700521;
double r2700523 = r2700517 + r2700522;
double r2700524 = 2.0;
double r2700525 = r2700523 * r2700524;
return r2700525;
}
double f(double a, double b, double c, double d) {
double r2700526 = 2.0;
double r2700527 = b;
double r2700528 = c;
double r2700529 = r2700527 + r2700528;
double r2700530 = d;
double r2700531 = a;
double r2700532 = r2700530 + r2700531;
double r2700533 = r2700529 + r2700532;
double r2700534 = r2700526 * r2700533;
return r2700534;
}




Bits error versus a




Bits error versus b




Bits error versus c




Bits error versus d
Results
| Original | 3.6 |
|---|---|
| Target | 3.9 |
| Herbie | 0 |
Initial program 3.6
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 2019142 +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))