\left(a + \left(b + \left(c + d\right)\right)\right) \cdot 2
2 \cdot \left(\left(b + c\right) + \left(a + d\right)\right)
double f(double a, double b, double c, double d) {
double r1402063 = a;
double r1402064 = b;
double r1402065 = c;
double r1402066 = d;
double r1402067 = r1402065 + r1402066;
double r1402068 = r1402064 + r1402067;
double r1402069 = r1402063 + r1402068;
double r1402070 = 2.0;
double r1402071 = r1402069 * r1402070;
return r1402071;
}
double f(double a, double b, double c, double d) {
double r1402072 = 2.0;
double r1402073 = b;
double r1402074 = c;
double r1402075 = r1402073 + r1402074;
double r1402076 = a;
double r1402077 = d;
double r1402078 = r1402076 + r1402077;
double r1402079 = r1402075 + r1402078;
double r1402080 = r1402072 * r1402079;
return r1402080;
}




Bits error versus a




Bits error versus b




Bits error versus c




Bits error versus d
Results
| Original | 3.7 |
|---|---|
| Target | 3.9 |
| Herbie | 0 |
Initial program 3.7
rmApplied associate-+r+2.8
rmApplied add-log-exp2.8
Applied add-log-exp2.8
Applied add-log-exp2.8
Applied sum-log2.8
Applied sum-log2.8
Applied add-log-exp2.8
Applied sum-log1.5
Simplified0.9
rmApplied exp-sum1.2
Applied log-prod0.7
Simplified0.5
Simplified0
Final simplification0
herbie shell --seed 2019155 +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))