\left(a + \left(b + \left(c + d\right)\right)\right) \cdot 2
\mathsf{log1p}\left(\log \left(e^{\mathsf{expm1}\left(d + \left(a + \left(b + c\right)\right)\right)}\right)\right) \cdot 2double code(double a, double b, double c, double d) {
return ((double) (((double) (a + ((double) (b + ((double) (c + d)))))) * 2.0));
}
double code(double a, double b, double c, double d) {
return ((double) (((double) log1p(((double) log(((double) exp(((double) expm1(((double) (d + ((double) (a + ((double) (b + c)))))))))))))) * 2.0));
}




Bits error versus a




Bits error versus b




Bits error versus c




Bits error versus d
Results
| Original | 3.7 |
|---|---|
| Target | 3.9 |
| Herbie | 3.0 |
Initial program 3.7
rmApplied associate-+r+2.8
rmApplied log1p-expm1-u2.8
rmApplied add-cbrt-cube2.9
Simplified2.9
rmApplied add-log-exp3.0
Simplified3.0
Final simplification3.0
herbie shell --seed 2020123 +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))