\frac{e^{a}}{e^{a} + e^{b}}e^{-\mathsf{log1p}\left(e^{b - a}\right)}double f(double a, double b) {
double r98221 = a;
double r98222 = exp(r98221);
double r98223 = b;
double r98224 = exp(r98223);
double r98225 = r98222 + r98224;
double r98226 = r98222 / r98225;
return r98226;
}
double f(double a, double b) {
double r98227 = b;
double r98228 = a;
double r98229 = r98227 - r98228;
double r98230 = exp(r98229);
double r98231 = log1p(r98230);
double r98232 = -r98231;
double r98233 = exp(r98232);
return r98233;
}




Bits error versus a




Bits error versus b
Results
| Original | 0.8 |
|---|---|
| Target | 0.0 |
| Herbie | 0.0 |
Initial program 0.8
rmApplied clear-num0.8
Simplified0.8
rmApplied add-exp-log0.8
Applied div-exp0.7
Simplified0.0
rmApplied rec-exp0.0
Simplified0.0
Final simplification0.0
herbie shell --seed 2019304 +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))))