\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 r5270624 = a;
double r5270625 = b;
double r5270626 = c;
double r5270627 = d;
double r5270628 = r5270626 + r5270627;
double r5270629 = r5270625 + r5270628;
double r5270630 = r5270624 + r5270629;
double r5270631 = 2.0;
double r5270632 = r5270630 * r5270631;
return r5270632;
}
double f(double a, double b, double c, double d) {
double r5270633 = 2.0;
double r5270634 = c;
double r5270635 = b;
double r5270636 = d;
double r5270637 = a;
double r5270638 = r5270636 + r5270637;
double r5270639 = r5270635 + r5270638;
double r5270640 = r5270634 + r5270639;
double r5270641 = r5270633 * r5270640;
return r5270641;
}




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.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
Simplified2.9
rmApplied associate-+r+0.9
rmApplied rem-log-exp0.0
Final simplification0.0
herbie shell --seed 2019174
(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))