\left(a + \left(b + \left(c + d\right)\right)\right) \cdot 2
2 \cdot \left(\left(c + b\right) + \left(a + d\right)\right)
double f(double a, double b, double c, double d) {
double r4824813 = a;
double r4824814 = b;
double r4824815 = c;
double r4824816 = d;
double r4824817 = r4824815 + r4824816;
double r4824818 = r4824814 + r4824817;
double r4824819 = r4824813 + r4824818;
double r4824820 = 2.0;
double r4824821 = r4824819 * r4824820;
return r4824821;
}
double f(double a, double b, double c, double d) {
double r4824822 = 2.0;
double r4824823 = c;
double r4824824 = b;
double r4824825 = r4824823 + r4824824;
double r4824826 = a;
double r4824827 = d;
double r4824828 = r4824826 + r4824827;
double r4824829 = r4824825 + r4824828;
double r4824830 = r4824822 * r4824829;
return r4824830;
}




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 add-log-exp3.7
Applied add-log-exp3.7
Applied sum-log3.7
Applied add-log-exp3.7
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 2019200 +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))