\left(a + \left(b + \left(c + d\right)\right)\right) \cdot 2
\left(\left(b + c\right) + \left(d + a\right)\right) \cdot 2
double code(double a, double b, double c, double d) {
return ((a + (b + (c + d))) * 2.0);
}
double code(double a, double b, double c, double d) {
return (((b + c) + (d + a)) * 2.0);
}




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 +-commutative2.8
rmApplied associate-+l+0
Final simplification0
herbie shell --seed 2020049 +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))