\left(a + \left(b + \left(c + d\right)\right)\right) \cdot 2
2 \cdot \left(\left(b + c\right) + \left(d + a\right)\right)
double f(double a, double b, double c, double d) {
double r5414556 = a;
double r5414557 = b;
double r5414558 = c;
double r5414559 = d;
double r5414560 = r5414558 + r5414559;
double r5414561 = r5414557 + r5414560;
double r5414562 = r5414556 + r5414561;
double r5414563 = 2.0;
double r5414564 = r5414562 * r5414563;
return r5414564;
}
double f(double a, double b, double c, double d) {
double r5414565 = 2.0;
double r5414566 = b;
double r5414567 = c;
double r5414568 = r5414566 + r5414567;
double r5414569 = d;
double r5414570 = a;
double r5414571 = r5414569 + r5414570;
double r5414572 = r5414568 + r5414571;
double r5414573 = r5414565 * r5414572;
return r5414573;
}




Bits error versus a




Bits error versus b




Bits error versus c




Bits error versus d
Results
| Original | 3.7 |
|---|---|
| Target | 3.8 |
| Herbie | 0 |
Initial program 3.7
rmApplied associate-+r+2.8
rmApplied add-log-exp2.8
Applied add-log-exp2.8
Applied add-log-exp2.8
Applied sum-log2.8
Applied sum-log2.8
Applied add-log-exp2.8
Applied sum-log1.5
Simplified0.9
rmApplied rem-log-exp0
Final simplification0
herbie shell --seed 2019172 +o rules:numerics
(FPCore (a b c d)
:name "Expression, p6"
:pre (and (<= -14.0 a -13.0) (<= -3.0 b -2.0) (<= 3.0 c 3.5) (<= 12.5 d 13.5))
:herbie-target
(+ (* (+ a b) 2.0) (* (+ c d) 2.0))
(* (+ a (+ b (+ c d))) 2.0))