\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 r1218164 = a;
double r1218165 = b;
double r1218166 = c;
double r1218167 = d;
double r1218168 = r1218166 + r1218167;
double r1218169 = r1218165 + r1218168;
double r1218170 = r1218164 + r1218169;
double r1218171 = 2.0;
double r1218172 = r1218170 * r1218171;
return r1218172;
}
double f(double a, double b, double c, double d) {
double r1218173 = 2.0;
double r1218174 = b;
double r1218175 = c;
double r1218176 = r1218174 + r1218175;
double r1218177 = a;
double r1218178 = d;
double r1218179 = r1218177 + r1218178;
double r1218180 = r1218176 + r1218179;
double r1218181 = r1218173 * r1218180;
return r1218181;
}




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.7
rmApplied add-log-exp2.7
Applied add-log-exp2.7
Applied sum-log2.7
Applied add-log-exp2.7
Applied sum-log1.4
Simplified0.9
rmApplied exp-sum1.2
Applied log-prod0.7
Simplified0.5
Simplified0
Final simplification0
herbie shell --seed 2019152 +o rules:numerics
(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))