\left(a + \left(b + \left(c + d\right)\right)\right) \cdot 2
2 \cdot \left(\left(b + c\right) + \left(a + d\right)\right)
double f(double a, double b, double c, double d) {
double r2613557 = a;
double r2613558 = b;
double r2613559 = c;
double r2613560 = d;
double r2613561 = r2613559 + r2613560;
double r2613562 = r2613558 + r2613561;
double r2613563 = r2613557 + r2613562;
double r2613564 = 2.0;
double r2613565 = r2613563 * r2613564;
return r2613565;
}
double f(double a, double b, double c, double d) {
double r2613566 = 2.0;
double r2613567 = b;
double r2613568 = c;
double r2613569 = r2613567 + r2613568;
double r2613570 = a;
double r2613571 = d;
double r2613572 = r2613570 + r2613571;
double r2613573 = r2613569 + r2613572;
double r2613574 = r2613566 * r2613573;
return r2613574;
}




Bits error versus a




Bits error versus b




Bits error versus c




Bits error versus d
Results
| Original | 3.6 |
|---|---|
| Target | 3.8 |
| Herbie | 0 |
Initial program 3.6
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 exp-sum1.2
Applied log-prod0.7
Simplified0.5
Simplified0
Final simplification0
herbie shell --seed 2019162 +o rules:numerics
(FPCore (a b c d)
:name "Expression, p6"
:pre (and (<= -14 a -13) (<= -3 b -2) (<= 3 c 3.5) (<= 12.5 d 13.5))
:herbie-target
(+ (* (+ a b) 2) (* (+ c d) 2))
(* (+ a (+ b (+ c d))) 2))