\frac{e^{a}}{e^{a} + e^{b}}\frac{e^{a}}{\mathsf{fma}\left(\sqrt{e^{a}}, \sqrt{e^{a}}, e^{b}\right)}double f(double a, double b) {
double r125287 = a;
double r125288 = exp(r125287);
double r125289 = b;
double r125290 = exp(r125289);
double r125291 = r125288 + r125290;
double r125292 = r125288 / r125291;
return r125292;
}
double f(double a, double b) {
double r125293 = a;
double r125294 = exp(r125293);
double r125295 = sqrt(r125294);
double r125296 = b;
double r125297 = exp(r125296);
double r125298 = fma(r125295, r125295, r125297);
double r125299 = r125294 / r125298;
return r125299;
}




Bits error versus a




Bits error versus b
| Original | 0.8 |
|---|---|
| Target | 0.0 |
| Herbie | 0.8 |
Initial program 0.8
rmApplied add-sqr-sqrt0.8
Applied fma-def0.8
Final simplification0.8
herbie shell --seed 2020083 +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))))