\frac{e^{a}}{e^{a} + e^{b}}
\frac{e^{a}}{\mathsf{fma}\left(0.5, a \cdot a, 1 + \left(a + e^{b}\right)\right)}
(FPCore (a b) :precision binary64 (/ (exp a) (+ (exp a) (exp b))))
(FPCore (a b) :precision binary64 (/ (exp a) (fma 0.5 (* a a) (+ 1.0 (+ a (exp b))))))
double code(double a, double b) {
return exp(a) / (exp(a) + exp(b));
}
double code(double a, double b) {
return exp(a) / fma(0.5, (a * a), (1.0 + (a + exp(b))));
}




Bits error versus a




Bits error versus b
| Original | 0.6 |
|---|---|
| Target | 0.0 |
| Herbie | 1.1 |
Initial program 0.6
Taylor expanded in a around 0 1.1
Simplified1.1
Final simplification1.1
herbie shell --seed 2021310
(FPCore (a b)
:name "Quotient of sum of exps"
:precision binary64
:herbie-target
(/ 1.0 (+ 1.0 (exp (- b a))))
(/ (exp a) (+ (exp a) (exp b))))