\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 r200387 = a;
double r200388 = exp(r200387);
double r200389 = b;
double r200390 = exp(r200389);
double r200391 = r200388 + r200390;
double r200392 = r200388 / r200391;
return r200392;
}
double f(double a, double b) {
double r200393 = a;
double r200394 = exp(r200393);
double r200395 = sqrt(r200394);
double r200396 = b;
double r200397 = exp(r200396);
double r200398 = fma(r200395, r200395, r200397);
double r200399 = r200394 / r200398;
return r200399;
}




Bits error versus a




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