\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 r123637 = a;
double r123638 = exp(r123637);
double r123639 = b;
double r123640 = exp(r123639);
double r123641 = r123638 + r123640;
double r123642 = r123638 / r123641;
return r123642;
}
double f(double a, double b) {
double r123643 = a;
double r123644 = exp(r123643);
double r123645 = sqrt(r123644);
double r123646 = b;
double r123647 = exp(r123646);
double r123648 = fma(r123645, r123645, r123647);
double r123649 = r123644 / r123648;
return r123649;
}




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