\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 r3129968 = a;
double r3129969 = b;
double r3129970 = c;
double r3129971 = d;
double r3129972 = r3129970 + r3129971;
double r3129973 = r3129969 + r3129972;
double r3129974 = r3129968 + r3129973;
double r3129975 = 2.0;
double r3129976 = r3129974 * r3129975;
return r3129976;
}
double f(double a, double b, double c, double d) {
double r3129977 = 2.0;
double r3129978 = b;
double r3129979 = c;
double r3129980 = r3129978 + r3129979;
double r3129981 = d;
double r3129982 = a;
double r3129983 = r3129981 + r3129982;
double r3129984 = r3129980 + r3129983;
double r3129985 = r3129977 * r3129984;
return r3129985;
}




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