\left(a + \left(b + \left(c + d\right)\right)\right) \cdot 2
\mathsf{log1p}\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{expm1}\left(\left(d + a\right) + \left(b + c\right)\right)\right)\right)\right) \cdot 2double f(double a, double b, double c, double d) {
double r102723 = a;
double r102724 = b;
double r102725 = c;
double r102726 = d;
double r102727 = r102725 + r102726;
double r102728 = r102724 + r102727;
double r102729 = r102723 + r102728;
double r102730 = 2.0;
double r102731 = r102729 * r102730;
return r102731;
}
double f(double a, double b, double c, double d) {
double r102732 = d;
double r102733 = a;
double r102734 = r102732 + r102733;
double r102735 = b;
double r102736 = c;
double r102737 = r102735 + r102736;
double r102738 = r102734 + r102737;
double r102739 = expm1(r102738);
double r102740 = log1p(r102739);
double r102741 = expm1(r102740);
double r102742 = log1p(r102741);
double r102743 = 2.0;
double r102744 = r102742 * r102743;
return r102744;
}




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.1 |
Initial program 3.7
rmApplied associate-+r+2.8
rmApplied log1p-expm1-u2.8
rmApplied log1p-expm1-u2.8
Simplified2.8
rmApplied associate-+r+0.1
Final simplification0.1
herbie shell --seed 2020002 +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))