\left(a + \left(b + \left(c + d\right)\right)\right) \cdot 2
2 \cdot \left(\left(b + c\right) + \left(a + d\right)\right)
double f(double a, double b, double c, double d) {
double r4318986 = a;
double r4318987 = b;
double r4318988 = c;
double r4318989 = d;
double r4318990 = r4318988 + r4318989;
double r4318991 = r4318987 + r4318990;
double r4318992 = r4318986 + r4318991;
double r4318993 = 2.0;
double r4318994 = r4318992 * r4318993;
return r4318994;
}
double f(double a, double b, double c, double d) {
double r4318995 = 2.0;
double r4318996 = b;
double r4318997 = c;
double r4318998 = r4318996 + r4318997;
double r4318999 = a;
double r4319000 = d;
double r4319001 = r4318999 + r4319000;
double r4319002 = r4318998 + r4319001;
double r4319003 = r4318995 * r4319002;
return r4319003;
}




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 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 exp-sum1.2
Applied log-prod0.8
Simplified0.5
Simplified0
Final simplification0
herbie shell --seed 2019179 +o rules:numerics
(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))