\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 r2304953 = a;
double r2304954 = b;
double r2304955 = c;
double r2304956 = d;
double r2304957 = r2304955 + r2304956;
double r2304958 = r2304954 + r2304957;
double r2304959 = r2304953 + r2304958;
double r2304960 = 2.0;
double r2304961 = r2304959 * r2304960;
return r2304961;
}
double f(double a, double b, double c, double d) {
double r2304962 = 2.0;
double r2304963 = b;
double r2304964 = c;
double r2304965 = r2304963 + r2304964;
double r2304966 = d;
double r2304967 = a;
double r2304968 = r2304966 + r2304967;
double r2304969 = r2304965 + r2304968;
double r2304970 = r2304962 * r2304969;
return r2304970;
}




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