\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 r2175494 = a;
double r2175495 = b;
double r2175496 = c;
double r2175497 = d;
double r2175498 = r2175496 + r2175497;
double r2175499 = r2175495 + r2175498;
double r2175500 = r2175494 + r2175499;
double r2175501 = 2.0;
double r2175502 = r2175500 * r2175501;
return r2175502;
}
double f(double a, double b, double c, double d) {
double r2175503 = 2.0;
double r2175504 = b;
double r2175505 = c;
double r2175506 = r2175504 + r2175505;
double r2175507 = d;
double r2175508 = a;
double r2175509 = r2175507 + r2175508;
double r2175510 = r2175506 + r2175509;
double r2175511 = r2175503 * r2175510;
return r2175511;
}




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 sum-log2.8
Applied add-log-exp2.8
Applied sum-log1.4
Simplified0.9
rmApplied rem-log-exp0
Final simplification0
herbie shell --seed 2019144 +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))