\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 r93189 = a;
double r93190 = exp(r93189);
double r93191 = b;
double r93192 = exp(r93191);
double r93193 = r93190 + r93192;
double r93194 = r93190 / r93193;
return r93194;
}
double f(double a, double b) {
double r93195 = a;
double r93196 = exp(r93195);
double r93197 = b;
double r93198 = exp(r93197);
double r93199 = r93196 + r93198;
double r93200 = log1p(r93199);
double r93201 = expm1(r93200);
double r93202 = r93196 / r93201;
return r93202;
}




Bits error versus a




Bits error versus b
Results
| Original | 0.7 |
|---|---|
| Target | 0.0 |
| Herbie | 1.1 |
Initial program 0.7
rmApplied expm1-log1p-u1.1
Final simplification1.1
herbie shell --seed 2019212 +o rules:numerics
(FPCore (a b)
:name "Quotient of sum of exps"
:precision binary64
:herbie-target
(/ 1 (+ 1 (exp (- b a))))
(/ (exp a) (+ (exp a) (exp b))))