\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 r1974220 = a;
double r1974221 = b;
double r1974222 = c;
double r1974223 = d;
double r1974224 = r1974222 + r1974223;
double r1974225 = r1974221 + r1974224;
double r1974226 = r1974220 + r1974225;
double r1974227 = 2.0;
double r1974228 = r1974226 * r1974227;
return r1974228;
}
double f(double a, double b, double c, double d) {
double r1974229 = 2.0;
double r1974230 = a;
double r1974231 = d;
double r1974232 = r1974230 + r1974231;
double r1974233 = c;
double r1974234 = r1974232 + r1974233;
double r1974235 = b;
double r1974236 = r1974234 + r1974235;
double r1974237 = r1974229 * r1974236;
return r1974237;
}




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