\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 r3124016 = a;
double r3124017 = b;
double r3124018 = c;
double r3124019 = d;
double r3124020 = r3124018 + r3124019;
double r3124021 = r3124017 + r3124020;
double r3124022 = r3124016 + r3124021;
double r3124023 = 2.0;
double r3124024 = r3124022 * r3124023;
return r3124024;
}
double f(double a, double b, double c, double d) {
double r3124025 = 2.0;
double r3124026 = b;
double r3124027 = c;
double r3124028 = r3124026 + r3124027;
double r3124029 = d;
double r3124030 = a;
double r3124031 = r3124029 + r3124030;
double r3124032 = r3124028 + r3124031;
double r3124033 = r3124025 * r3124032;
return r3124033;
}




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