\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 r1546686 = a;
double r1546687 = b;
double r1546688 = c;
double r1546689 = d;
double r1546690 = r1546688 + r1546689;
double r1546691 = r1546687 + r1546690;
double r1546692 = r1546686 + r1546691;
double r1546693 = 2.0;
double r1546694 = r1546692 * r1546693;
return r1546694;
}
double f(double a, double b, double c, double d) {
double r1546695 = 2.0;
double r1546696 = b;
double r1546697 = c;
double r1546698 = r1546696 + r1546697;
double r1546699 = d;
double r1546700 = a;
double r1546701 = r1546699 + r1546700;
double r1546702 = r1546698 + r1546701;
double r1546703 = r1546695 * r1546702;
return r1546703;
}




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