\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 r5281653 = a;
double r5281654 = b;
double r5281655 = c;
double r5281656 = d;
double r5281657 = r5281655 + r5281656;
double r5281658 = r5281654 + r5281657;
double r5281659 = r5281653 + r5281658;
double r5281660 = 2.0;
double r5281661 = r5281659 * r5281660;
return r5281661;
}
double f(double a, double b, double c, double d) {
double r5281662 = 2.0;
double r5281663 = b;
double r5281664 = c;
double r5281665 = r5281663 + r5281664;
double r5281666 = d;
double r5281667 = a;
double r5281668 = r5281666 + r5281667;
double r5281669 = r5281665 + r5281668;
double r5281670 = r5281662 * r5281669;
return r5281670;
}




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.7
rmApplied add-log-exp2.7
Applied add-log-exp2.7
Applied add-log-exp2.7
Applied sum-log2.7
Applied sum-log2.7
Applied add-log-exp2.7
Applied sum-log1.5
Simplified0.9
rmApplied rem-log-exp0
Final simplification0
herbie shell --seed 2019170
(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))