a \cdot \left(\left(b + c\right) + d\right)
\left(d \cdot a + c \cdot a\right) + b \cdot a
double f(double a, double b, double c, double d) {
double r4907946 = a;
double r4907947 = b;
double r4907948 = c;
double r4907949 = r4907947 + r4907948;
double r4907950 = d;
double r4907951 = r4907949 + r4907950;
double r4907952 = r4907946 * r4907951;
return r4907952;
}
double f(double a, double b, double c, double d) {
double r4907953 = d;
double r4907954 = a;
double r4907955 = r4907953 * r4907954;
double r4907956 = c;
double r4907957 = r4907956 * r4907954;
double r4907958 = r4907955 + r4907957;
double r4907959 = b;
double r4907960 = r4907959 * r4907954;
double r4907961 = r4907958 + r4907960;
return r4907961;
}




Bits error versus a




Bits error versus b




Bits error versus c




Bits error versus d
Results
| Original | 0.0 |
|---|---|
| Target | 0.0 |
| Herbie | 0.0 |
Initial program 0.0
rmApplied distribute-lft-in0.0
rmApplied distribute-rgt-in0.0
Applied associate-+l+0.0
Final simplification0.0
herbie shell --seed 2019172
(FPCore (a b c d)
:name "Expression, p14"
:pre (and (<= 56789.0 a 98765.0) (<= 0.0 b 1.0) (<= 0.0 c 0.0016773) (<= 0.0 d 0.0016773))
:herbie-target
(+ (* a b) (* a (+ c d)))
(* a (+ (+ b c) d)))