\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 r4862963 = a;
double r4862964 = b;
double r4862965 = c;
double r4862966 = d;
double r4862967 = r4862965 + r4862966;
double r4862968 = r4862964 + r4862967;
double r4862969 = r4862963 + r4862968;
double r4862970 = 2.0;
double r4862971 = r4862969 * r4862970;
return r4862971;
}
double f(double a, double b, double c, double d) {
double r4862972 = 2.0;
double r4862973 = b;
double r4862974 = c;
double r4862975 = r4862973 + r4862974;
double r4862976 = d;
double r4862977 = a;
double r4862978 = r4862976 + r4862977;
double r4862979 = r4862975 + r4862978;
double r4862980 = r4862972 * r4862979;
return r4862980;
}




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 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 2019172
(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))