\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 r5780324 = a;
double r5780325 = b;
double r5780326 = c;
double r5780327 = d;
double r5780328 = r5780326 + r5780327;
double r5780329 = r5780325 + r5780328;
double r5780330 = r5780324 + r5780329;
double r5780331 = 2.0;
double r5780332 = r5780330 * r5780331;
return r5780332;
}
double f(double a, double b, double c, double d) {
double r5780333 = 2.0;
double r5780334 = b;
double r5780335 = c;
double r5780336 = r5780334 + r5780335;
double r5780337 = d;
double r5780338 = a;
double r5780339 = r5780337 + r5780338;
double r5780340 = r5780336 + r5780339;
double r5780341 = r5780333 * r5780340;
return r5780341;
}




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 rem-log-exp0
Final simplification0
herbie shell --seed 2019169
(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))