\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 r3424632 = a;
double r3424633 = b;
double r3424634 = c;
double r3424635 = d;
double r3424636 = r3424634 + r3424635;
double r3424637 = r3424633 + r3424636;
double r3424638 = r3424632 + r3424637;
double r3424639 = 2.0;
double r3424640 = r3424638 * r3424639;
return r3424640;
}
double f(double a, double b, double c, double d) {
double r3424641 = 2.0;
double r3424642 = b;
double r3424643 = c;
double r3424644 = r3424642 + r3424643;
double r3424645 = d;
double r3424646 = a;
double r3424647 = r3424645 + r3424646;
double r3424648 = r3424644 + r3424647;
double r3424649 = r3424641 * r3424648;
return r3424649;
}




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