\frac{e^{a}}{e^{a} + e^{b}}
\begin{array}{l}
t_0 := \sqrt{e^{a}}\\
\frac{e^{a}}{\mathsf{fma}\left(t_0, t_0, e^{b}\right)}
\end{array}
(FPCore (a b) :precision binary64 (/ (exp a) (+ (exp a) (exp b))))
(FPCore (a b) :precision binary64 (let* ((t_0 (sqrt (exp a)))) (/ (exp a) (fma t_0 t_0 (exp b)))))
double code(double a, double b) {
return exp(a) / (exp(a) + exp(b));
}
double code(double a, double b) {
double t_0 = sqrt(exp(a));
return exp(a) / fma(t_0, t_0, exp(b));
}




Bits error versus a




Bits error versus b
| Original | 0.6 |
|---|---|
| Target | 0.0 |
| Herbie | 0.6 |
Initial program 0.6
Applied add-sqr-sqrt_binary640.6
Applied fma-def_binary640.6
Final simplification0.6
herbie shell --seed 2022094
(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))))