\left(a + \left(b + \left(c + d\right)\right)\right) \cdot 2
2 \cdot \left(\left(a + d\right) + \left(b + c\right)\right)
double f(double a, double b, double c, double d) {
double r48918 = a;
double r48919 = b;
double r48920 = c;
double r48921 = d;
double r48922 = r48920 + r48921;
double r48923 = r48919 + r48922;
double r48924 = r48918 + r48923;
double r48925 = 2.0;
double r48926 = r48924 * r48925;
return r48926;
}
double f(double a, double b, double c, double d) {
double r48927 = 2.0;
double r48928 = a;
double r48929 = d;
double r48930 = r48928 + r48929;
double r48931 = b;
double r48932 = c;
double r48933 = r48931 + r48932;
double r48934 = r48930 + r48933;
double r48935 = r48927 * r48934;
return r48935;
}




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-cbrt-cube2.9
Simplified2.9
rmApplied associate-+r+2.9
rmApplied *-un-lft-identity2.9
Applied unpow-prod-down2.9
Applied cbrt-prod2.9
Simplified2.9
Simplified0
Final simplification0
herbie shell --seed 2019235 +o rules:numerics
(FPCore (a b c d)
:name "Expression, p6"
:precision binary64
: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))