\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 r3079389 = a;
double r3079390 = b;
double r3079391 = c;
double r3079392 = d;
double r3079393 = r3079391 + r3079392;
double r3079394 = r3079390 + r3079393;
double r3079395 = r3079389 + r3079394;
double r3079396 = 2.0;
double r3079397 = r3079395 * r3079396;
return r3079397;
}
double f(double a, double b, double c, double d) {
double r3079398 = 2.0;
double r3079399 = a;
double r3079400 = d;
double r3079401 = r3079399 + r3079400;
double r3079402 = c;
double r3079403 = r3079401 + r3079402;
double r3079404 = b;
double r3079405 = r3079403 + r3079404;
double r3079406 = r3079398 * r3079405;
return r3079406;
}




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-log2.8
Applied add-log-exp2.8
Applied sum-log1.5
Simplified0.9
rmApplied rem-log-exp0.0
rmApplied associate-+l+0
Final simplification0
herbie shell --seed 2019139
(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))