\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 r3783926 = a;
double r3783927 = b;
double r3783928 = c;
double r3783929 = d;
double r3783930 = r3783928 + r3783929;
double r3783931 = r3783927 + r3783930;
double r3783932 = r3783926 + r3783931;
double r3783933 = 2.0;
double r3783934 = r3783932 * r3783933;
return r3783934;
}
double f(double a, double b, double c, double d) {
double r3783935 = 2.0;
double r3783936 = a;
double r3783937 = d;
double r3783938 = r3783936 + r3783937;
double r3783939 = c;
double r3783940 = r3783938 + r3783939;
double r3783941 = b;
double r3783942 = r3783940 + r3783941;
double r3783943 = r3783935 * r3783942;
return r3783943;
}




Bits error versus a




Bits error versus b




Bits error versus c




Bits error versus d
Results
| Original | 3.7 |
|---|---|
| Target | 3.8 |
| Herbie | 0 |
Initial program 3.7
rmApplied add-log-exp3.7
Applied add-log-exp3.7
Applied sum-log3.7
Applied add-log-exp3.7
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 2019146
(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))