\left(a + \left(b + \left(c + d\right)\right)\right) \cdot 2
2 \cdot \left(\left(d + a\right) + \left(b + c\right)\right)
double f(double a, double b, double c, double d) {
double r121951 = a;
double r121952 = b;
double r121953 = c;
double r121954 = d;
double r121955 = r121953 + r121954;
double r121956 = r121952 + r121955;
double r121957 = r121951 + r121956;
double r121958 = 2.0;
double r121959 = r121957 * r121958;
return r121959;
}
double f(double a, double b, double c, double d) {
double r121960 = 2.0;
double r121961 = d;
double r121962 = a;
double r121963 = r121961 + r121962;
double r121964 = b;
double r121965 = c;
double r121966 = r121964 + r121965;
double r121967 = r121963 + r121966;
double r121968 = r121960 * r121967;
return r121968;
}




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 *-un-lft-identity3.7
Applied *-un-lft-identity3.7
Applied distribute-lft-out3.7
Simplified2.8
rmApplied distribute-rgt-in2.8
Applied associate-+r+0
Simplified0
Final simplification0
herbie shell --seed 2020043 +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))