\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 r3922404 = a;
double r3922405 = b;
double r3922406 = c;
double r3922407 = d;
double r3922408 = r3922406 + r3922407;
double r3922409 = r3922405 + r3922408;
double r3922410 = r3922404 + r3922409;
double r3922411 = 2.0;
double r3922412 = r3922410 * r3922411;
return r3922412;
}
double f(double a, double b, double c, double d) {
double r3922413 = 2.0;
double r3922414 = b;
double r3922415 = c;
double r3922416 = r3922414 + r3922415;
double r3922417 = a;
double r3922418 = d;
double r3922419 = r3922417 + r3922418;
double r3922420 = r3922416 + r3922419;
double r3922421 = r3922413 * r3922420;
return r3922421;
}




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 exp-sum1.2
Applied log-prod0.8
Simplified0.5
Simplified0
Final simplification0
herbie shell --seed 2019171 +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))