\left(a + \left(b + \left(c + d\right)\right)\right) \cdot 2
2 \cdot \left(c + \left(b + \left(d + a\right)\right)\right)
double f(double a, double b, double c, double d) {
double r5478625 = a;
double r5478626 = b;
double r5478627 = c;
double r5478628 = d;
double r5478629 = r5478627 + r5478628;
double r5478630 = r5478626 + r5478629;
double r5478631 = r5478625 + r5478630;
double r5478632 = 2.0;
double r5478633 = r5478631 * r5478632;
return r5478633;
}
double f(double a, double b, double c, double d) {
double r5478634 = 2.0;
double r5478635 = c;
double r5478636 = b;
double r5478637 = d;
double r5478638 = a;
double r5478639 = r5478637 + r5478638;
double r5478640 = r5478636 + r5478639;
double r5478641 = r5478635 + r5478640;
double r5478642 = r5478634 * r5478641;
return r5478642;
}




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.0 |
Initial program 3.6
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
Simplified2.9
rmApplied associate-+r+0.9
rmApplied rem-log-exp0.0
Final simplification0.0
herbie shell --seed 2019192
(FPCore (a b c d)
:name "Expression, p6"
:pre (and (<= -14.0 a -13.0) (<= -3.0 b -2.0) (<= 3.0 c 3.5) (<= 12.5 d 13.5))
:herbie-target
(+ (* (+ a b) 2.0) (* (+ c d) 2.0))
(* (+ a (+ b (+ c d))) 2.0))