\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 r3311318 = a;
double r3311319 = b;
double r3311320 = c;
double r3311321 = d;
double r3311322 = r3311320 + r3311321;
double r3311323 = r3311319 + r3311322;
double r3311324 = r3311318 + r3311323;
double r3311325 = 2.0;
double r3311326 = r3311324 * r3311325;
return r3311326;
}
double f(double a, double b, double c, double d) {
double r3311327 = 2.0;
double r3311328 = b;
double r3311329 = c;
double r3311330 = r3311328 + r3311329;
double r3311331 = d;
double r3311332 = a;
double r3311333 = r3311331 + r3311332;
double r3311334 = r3311330 + r3311333;
double r3311335 = r3311327 * r3311334;
return r3311335;
}




Bits error versus a




Bits error versus b




Bits error versus c




Bits error versus d
Results
| Original | 3.6 |
|---|---|
| Target | 3.8 |
| Herbie | 0 |
Initial program 3.6
rmApplied associate-+r+2.7
rmApplied add-log-exp2.7
Applied add-log-exp2.7
Applied add-log-exp2.7
Applied sum-log2.7
Applied sum-log2.7
Applied add-log-exp2.7
Applied sum-log1.5
Simplified0.9
rmApplied exp-sum1.2
Applied log-prod0.7
Simplified0.5
Simplified0
Final simplification0
herbie shell --seed 2019152 +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))