\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 r2460807 = a;
double r2460808 = b;
double r2460809 = c;
double r2460810 = d;
double r2460811 = r2460809 + r2460810;
double r2460812 = r2460808 + r2460811;
double r2460813 = r2460807 + r2460812;
double r2460814 = 2.0;
double r2460815 = r2460813 * r2460814;
return r2460815;
}
double f(double a, double b, double c, double d) {
double r2460816 = 2.0;
double r2460817 = b;
double r2460818 = c;
double r2460819 = r2460817 + r2460818;
double r2460820 = d;
double r2460821 = a;
double r2460822 = r2460820 + r2460821;
double r2460823 = r2460819 + r2460822;
double r2460824 = r2460816 * r2460823;
return r2460824;
}




Bits error versus a




Bits error versus b




Bits error versus c




Bits error versus d
Results
| Original | 3.7 |
|---|---|
| Target | 3.8 |
| 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.6
Simplified0.9
rmApplied rem-log-exp0
Final simplification0
herbie shell --seed 2019168 +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))