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 r34723679 = a;
double r34723680 = b;
double r34723681 = c;
double r34723682 = r34723680 + r34723681;
double r34723683 = d;
double r34723684 = r34723682 + r34723683;
double r34723685 = r34723679 * r34723684;
return r34723685;
}
double f(double a, double b, double c, double d) {
double r34723686 = d;
double r34723687 = a;
double r34723688 = r34723686 * r34723687;
double r34723689 = c;
double r34723690 = r34723689 * r34723687;
double r34723691 = r34723688 + r34723690;
double r34723692 = b;
double r34723693 = r34723692 * r34723687;
double r34723694 = r34723691 + r34723693;
return r34723694;
}




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