\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 r2714038 = a;
double r2714039 = b;
double r2714040 = c;
double r2714041 = d;
double r2714042 = r2714040 + r2714041;
double r2714043 = r2714039 + r2714042;
double r2714044 = r2714038 + r2714043;
double r2714045 = 2.0;
double r2714046 = r2714044 * r2714045;
return r2714046;
}
double f(double a, double b, double c, double d) {
double r2714047 = 2.0;
double r2714048 = a;
double r2714049 = d;
double r2714050 = r2714048 + r2714049;
double r2714051 = c;
double r2714052 = r2714050 + r2714051;
double r2714053 = b;
double r2714054 = r2714052 + r2714053;
double r2714055 = r2714047 * r2714054;
return r2714055;
}




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-log3.7
Simplified0.9
rmApplied rem-log-exp0.0
rmApplied associate-+l+0
Final simplification0
herbie shell --seed 2019138
(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))