\left(a + \left(b + \left(c + d\right)\right)\right) \cdot 2
2 \cdot \left(\left(\left(a + d\right) + c\right) + b\right)
double f(double a, double b, double c, double d) {
double r3406579 = a;
double r3406580 = b;
double r3406581 = c;
double r3406582 = d;
double r3406583 = r3406581 + r3406582;
double r3406584 = r3406580 + r3406583;
double r3406585 = r3406579 + r3406584;
double r3406586 = 2.0;
double r3406587 = r3406585 * r3406586;
return r3406587;
}
double f(double a, double b, double c, double d) {
double r3406588 = 2.0;
double r3406589 = a;
double r3406590 = d;
double r3406591 = r3406589 + r3406590;
double r3406592 = c;
double r3406593 = r3406591 + r3406592;
double r3406594 = b;
double r3406595 = r3406593 + r3406594;
double r3406596 = r3406588 * r3406595;
return r3406596;
}




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 |
Initial program 3.6
rmApplied add-log-exp3.6
Applied add-log-exp3.6
Applied sum-log3.6
Applied add-log-exp3.6
Applied sum-log2.8
Applied add-log-exp2.8
Applied sum-log1.5
Simplified0.9
rmApplied rem-log-exp0.0
rmApplied associate-+l+0
Final simplification0
herbie shell --seed 2019162
(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))