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 r4602730 = a;
double r4602731 = b;
double r4602732 = c;
double r4602733 = r4602731 + r4602732;
double r4602734 = d;
double r4602735 = r4602733 + r4602734;
double r4602736 = r4602730 * r4602735;
return r4602736;
}
double f(double a, double b, double c, double d) {
double r4602737 = a;
double r4602738 = b;
double r4602739 = r4602737 * r4602738;
double r4602740 = c;
double r4602741 = d;
double r4602742 = r4602740 + r4602741;
double r4602743 = r4602742 * r4602737;
double r4602744 = r4602739 + r4602743;
return r4602744;
}




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