\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 r1320932 = a;
double r1320933 = b;
double r1320934 = c;
double r1320935 = d;
double r1320936 = r1320934 + r1320935;
double r1320937 = r1320933 + r1320936;
double r1320938 = r1320932 + r1320937;
double r1320939 = 2.0;
double r1320940 = r1320938 * r1320939;
return r1320940;
}
double f(double a, double b, double c, double d) {
double r1320941 = 2.0;
double r1320942 = b;
double r1320943 = c;
double r1320944 = r1320942 + r1320943;
double r1320945 = d;
double r1320946 = a;
double r1320947 = r1320945 + r1320946;
double r1320948 = r1320944 + r1320947;
double r1320949 = r1320941 * r1320948;
return r1320949;
}




Bits error versus a




Bits error versus b




Bits error versus c




Bits error versus d
Results
| Original | 3.7 |
|---|---|
| Target | 3.9 |
| 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 2019156 +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))