\left(a + \left(b + \left(c + d\right)\right)\right) \cdot 2
2 \cdot \left(\left(\left(a + d\right) + c\right) + b\right)
double f(double a, double b, double c, double d) {
double r3135231 = a;
double r3135232 = b;
double r3135233 = c;
double r3135234 = d;
double r3135235 = r3135233 + r3135234;
double r3135236 = r3135232 + r3135235;
double r3135237 = r3135231 + r3135236;
double r3135238 = 2.0;
double r3135239 = r3135237 * r3135238;
return r3135239;
}
double f(double a, double b, double c, double d) {
double r3135240 = 2.0;
double r3135241 = a;
double r3135242 = d;
double r3135243 = r3135241 + r3135242;
double r3135244 = c;
double r3135245 = r3135243 + r3135244;
double r3135246 = b;
double r3135247 = r3135245 + r3135246;
double r3135248 = r3135240 * r3135247;
return r3135248;
}




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 add-log-exp3.6
Applied add-log-exp3.6
Applied sum-log3.6
Applied add-log-exp3.6
Applied sum-log3.7
Simplified0.9
rmApplied rem-log-exp0.0
rmApplied associate-+l+0
Final simplification0
herbie shell --seed 2019141
(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))