\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 r106875 = a;
double r106876 = exp(r106875);
double r106877 = b;
double r106878 = exp(r106877);
double r106879 = r106876 + r106878;
double r106880 = r106876 / r106879;
return r106880;
}
double f(double a, double b) {
double r106881 = a;
double r106882 = exp(r106881);
double r106883 = sqrt(r106882);
double r106884 = b;
double r106885 = exp(r106884);
double r106886 = fma(r106883, r106883, r106885);
double r106887 = r106882 / r106886;
return r106887;
}




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))))