\frac{e^{a}}{e^{a} + e^{b}}\frac{e^{a}}{\mathsf{expm1}\left(\mathsf{log1p}\left(e^{a} + e^{b}\right)\right)}double f(double a, double b) {
double r4793425 = a;
double r4793426 = exp(r4793425);
double r4793427 = b;
double r4793428 = exp(r4793427);
double r4793429 = r4793426 + r4793428;
double r4793430 = r4793426 / r4793429;
return r4793430;
}
double f(double a, double b) {
double r4793431 = a;
double r4793432 = exp(r4793431);
double r4793433 = b;
double r4793434 = exp(r4793433);
double r4793435 = r4793432 + r4793434;
double r4793436 = log1p(r4793435);
double r4793437 = expm1(r4793436);
double r4793438 = r4793432 / r4793437;
return r4793438;
}




Bits error versus a




Bits error versus b
Results
| Original | 0.7 |
|---|---|
| Target | 0.0 |
| Herbie | 1.0 |
Initial program 0.7
Taylor expanded around -inf 0.7
rmApplied expm1-log1p-u1.0
Final simplification1.0
herbie shell --seed 2019144 +o rules:numerics
(FPCore (a b)
:name "Quotient of sum of exps"
:herbie-target
(/ 1 (+ 1 (exp (- b a))))
(/ (exp a) (+ (exp a) (exp b))))