\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 r3065806 = a;
double r3065807 = b;
double r3065808 = c;
double r3065809 = d;
double r3065810 = r3065808 + r3065809;
double r3065811 = r3065807 + r3065810;
double r3065812 = r3065806 + r3065811;
double r3065813 = 2.0;
double r3065814 = r3065812 * r3065813;
return r3065814;
}
double f(double a, double b, double c, double d) {
double r3065815 = 2.0;
double r3065816 = b;
double r3065817 = c;
double r3065818 = r3065816 + r3065817;
double r3065819 = d;
double r3065820 = a;
double r3065821 = r3065819 + r3065820;
double r3065822 = r3065818 + r3065821;
double r3065823 = r3065815 * r3065822;
return r3065823;
}




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 sum-log2.8
Applied add-log-exp2.8
Applied sum-log1.4
Simplified0.9
rmApplied rem-log-exp0
Final simplification0
herbie shell --seed 2019143 +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))