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 r3770242 = a;
double r3770243 = b;
double r3770244 = c;
double r3770245 = r3770243 + r3770244;
double r3770246 = d;
double r3770247 = r3770245 + r3770246;
double r3770248 = r3770242 * r3770247;
return r3770248;
}
double f(double a, double b, double c, double d) {
double r3770249 = a;
double r3770250 = b;
double r3770251 = r3770249 * r3770250;
double r3770252 = c;
double r3770253 = d;
double r3770254 = r3770252 + r3770253;
double r3770255 = r3770254 * r3770249;
double r3770256 = r3770251 + r3770255;
return r3770256;
}




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 2019163
(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)))