a \cdot \left(\left(b + c\right) + d\right)
a \cdot b + \left(c + d\right) \cdot a
double f(double a, double b, double c, double d) {
double r1810311 = a;
double r1810312 = b;
double r1810313 = c;
double r1810314 = r1810312 + r1810313;
double r1810315 = d;
double r1810316 = r1810314 + r1810315;
double r1810317 = r1810311 * r1810316;
return r1810317;
}
double f(double a, double b, double c, double d) {
double r1810318 = a;
double r1810319 = b;
double r1810320 = r1810318 * r1810319;
double r1810321 = c;
double r1810322 = d;
double r1810323 = r1810321 + r1810322;
double r1810324 = r1810323 * r1810318;
double r1810325 = r1810320 + r1810324;
return r1810325;
}




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-lft-in0.0
Applied associate-+l+0.0
Simplified0.0
Final simplification0.0
herbie shell --seed 2019153 +o rules:numerics
(FPCore (a b c d)
:name "Expression, p14"
:pre (and (<= 56789 a 98765) (<= 0 b 1) (<= 0 c 0.0016773) (<= 0 d 0.0016773))
:herbie-target
(+ (* a b) (* a (+ c d)))
(* a (+ (+ b c) d)))