\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 r3935437 = a;
double r3935438 = b;
double r3935439 = c;
double r3935440 = d;
double r3935441 = r3935439 + r3935440;
double r3935442 = r3935438 + r3935441;
double r3935443 = r3935437 + r3935442;
double r3935444 = 2.0;
double r3935445 = r3935443 * r3935444;
return r3935445;
}
double f(double a, double b, double c, double d) {
double r3935446 = 2.0;
double r3935447 = b;
double r3935448 = c;
double r3935449 = r3935447 + r3935448;
double r3935450 = d;
double r3935451 = a;
double r3935452 = r3935450 + r3935451;
double r3935453 = r3935449 + r3935452;
double r3935454 = r3935446 * r3935453;
return r3935454;
}




Bits error versus a




Bits error versus b




Bits error versus c




Bits error versus d
Results
| Original | 3.7 |
|---|---|
| Target | 3.9 |
| 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 2019174 +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))