\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 r3850794 = a;
double r3850795 = b;
double r3850796 = c;
double r3850797 = d;
double r3850798 = r3850796 + r3850797;
double r3850799 = r3850795 + r3850798;
double r3850800 = r3850794 + r3850799;
double r3850801 = 2.0;
double r3850802 = r3850800 * r3850801;
return r3850802;
}
double f(double a, double b, double c, double d) {
double r3850803 = 2.0;
double r3850804 = b;
double r3850805 = c;
double r3850806 = r3850804 + r3850805;
double r3850807 = d;
double r3850808 = a;
double r3850809 = r3850807 + r3850808;
double r3850810 = r3850806 + r3850809;
double r3850811 = r3850803 * r3850810;
return r3850811;
}




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 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 2019165
(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))