\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 r1523734 = a;
double r1523735 = b;
double r1523736 = c;
double r1523737 = d;
double r1523738 = r1523736 + r1523737;
double r1523739 = r1523735 + r1523738;
double r1523740 = r1523734 + r1523739;
double r1523741 = 2.0;
double r1523742 = r1523740 * r1523741;
return r1523742;
}
double f(double a, double b, double c, double d) {
double r1523743 = 2.0;
double r1523744 = b;
double r1523745 = c;
double r1523746 = r1523744 + r1523745;
double r1523747 = d;
double r1523748 = a;
double r1523749 = r1523747 + r1523748;
double r1523750 = r1523746 + r1523749;
double r1523751 = r1523743 * r1523750;
return r1523751;
}




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 2019151 +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))