\frac{e^{a}}{e^{a} + e^{b}}e^{a - \log \left(\mathsf{fma}\left(\sqrt{e^{a}}, \sqrt{e^{a}}, e^{b}\right)\right)}double f(double a, double b) {
double r154230 = a;
double r154231 = exp(r154230);
double r154232 = b;
double r154233 = exp(r154232);
double r154234 = r154231 + r154233;
double r154235 = r154231 / r154234;
return r154235;
}
double f(double a, double b) {
double r154236 = a;
double r154237 = exp(r154236);
double r154238 = sqrt(r154237);
double r154239 = b;
double r154240 = exp(r154239);
double r154241 = fma(r154238, r154238, r154240);
double r154242 = log(r154241);
double r154243 = r154236 - r154242;
double r154244 = exp(r154243);
return r154244;
}




Bits error versus a




Bits error versus b
| Original | 0.6 |
|---|---|
| Target | 0.0 |
| Herbie | 0.5 |
Initial program 0.6
rmApplied add-exp-log0.6
Applied div-exp0.5
rmApplied add-sqr-sqrt0.5
Applied fma-def0.5
Final simplification0.5
herbie shell --seed 2020065 +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))))