\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 r1387028 = a;
double r1387029 = b;
double r1387030 = c;
double r1387031 = d;
double r1387032 = r1387030 + r1387031;
double r1387033 = r1387029 + r1387032;
double r1387034 = r1387028 + r1387033;
double r1387035 = 2.0;
double r1387036 = r1387034 * r1387035;
return r1387036;
}
double f(double a, double b, double c, double d) {
double r1387037 = 2.0;
double r1387038 = b;
double r1387039 = c;
double r1387040 = r1387038 + r1387039;
double r1387041 = d;
double r1387042 = a;
double r1387043 = r1387041 + r1387042;
double r1387044 = r1387040 + r1387043;
double r1387045 = r1387037 * r1387044;
return r1387045;
}




Bits error versus a




Bits error versus b




Bits error versus c




Bits error versus d
Results
| Original | 3.6 |
|---|---|
| Target | 3.8 |
| Herbie | 0 |
Initial program 3.6
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 2019153 +o rules:numerics
(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))