\left(a + \left(b + \left(c + d\right)\right)\right) \cdot 2
2 \cdot \left(c + \left(b + \left(a + d\right)\right)\right)
double f(double a, double b, double c, double d) {
double r6627912 = a;
double r6627913 = b;
double r6627914 = c;
double r6627915 = d;
double r6627916 = r6627914 + r6627915;
double r6627917 = r6627913 + r6627916;
double r6627918 = r6627912 + r6627917;
double r6627919 = 2.0;
double r6627920 = r6627918 * r6627919;
return r6627920;
}
double f(double a, double b, double c, double d) {
double r6627921 = 2.0;
double r6627922 = c;
double r6627923 = b;
double r6627924 = a;
double r6627925 = d;
double r6627926 = r6627924 + r6627925;
double r6627927 = r6627923 + r6627926;
double r6627928 = r6627922 + r6627927;
double r6627929 = r6627921 * r6627928;
return r6627929;
}




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.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
Simplified3.0
rmApplied associate-+r+0.9
rmApplied exp-sum1.2
Applied log-prod0.0
Simplified0.0
Simplified0.0
Final simplification0.0
herbie shell --seed 2019172
(FPCore (a b c d)
:name "Expression, p6"
:pre (and (<= -14.0 a -13.0) (<= -3.0 b -2.0) (<= 3.0 c 3.5) (<= 12.5 d 13.5))
:herbie-target
(+ (* (+ a b) 2.0) (* (+ c d) 2.0))
(* (+ a (+ b (+ c d))) 2.0))