\frac{e^{a}}{e^{a} + e^{b}}e^{a} \cdot \frac{1}{e^{b} + e^{a}}double f(double a, double b) {
double r120667 = a;
double r120668 = exp(r120667);
double r120669 = b;
double r120670 = exp(r120669);
double r120671 = r120668 + r120670;
double r120672 = r120668 / r120671;
return r120672;
}
double f(double a, double b) {
double r120673 = a;
double r120674 = exp(r120673);
double r120675 = 1.0;
double r120676 = b;
double r120677 = exp(r120676);
double r120678 = r120677 + r120674;
double r120679 = r120675 / r120678;
double r120680 = r120674 * r120679;
return r120680;
}




Bits error versus a




Bits error versus b
Results
| Original | 0.6 |
|---|---|
| Target | 0.0 |
| Herbie | 0.6 |
Initial program 0.6
rmApplied add-exp-log0.6
Applied div-exp0.5
rmApplied sub-neg0.5
Applied exp-sum0.6
Simplified0.6
Final simplification0.6
herbie shell --seed 2019323 +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))))