\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 r108130 = a;
double r108131 = exp(r108130);
double r108132 = b;
double r108133 = exp(r108132);
double r108134 = r108131 + r108133;
double r108135 = r108131 / r108134;
return r108135;
}
double f(double a, double b) {
double r108136 = a;
double r108137 = exp(r108136);
double r108138 = sqrt(r108137);
double r108139 = b;
double r108140 = exp(r108139);
double r108141 = fma(r108138, r108138, r108140);
double r108142 = r108137 / r108141;
return r108142;
}




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