\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 r3651054 = a;
double r3651055 = b;
double r3651056 = c;
double r3651057 = d;
double r3651058 = r3651056 + r3651057;
double r3651059 = r3651055 + r3651058;
double r3651060 = r3651054 + r3651059;
double r3651061 = 2.0;
double r3651062 = r3651060 * r3651061;
return r3651062;
}
double f(double a, double b, double c, double d) {
double r3651063 = 2.0;
double r3651064 = b;
double r3651065 = c;
double r3651066 = r3651064 + r3651065;
double r3651067 = d;
double r3651068 = a;
double r3651069 = r3651067 + r3651068;
double r3651070 = r3651066 + r3651069;
double r3651071 = r3651063 * r3651070;
return r3651071;
}




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 exp-sum1.2
Applied log-prod0.8
Simplified0.5
Simplified0
Final simplification0
herbie shell --seed 2019146 +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))