\frac{e^{a}}{e^{a} + e^{b}}
\begin{array}{l}
\mathbf{if}\;e^{a} \leq 1.769608985345696 \cdot 10^{+308}:\\
\;\;\;\;\begin{array}{l}
t_0 := \sqrt{e^{a}}\\
\frac{e^{a}}{\mathsf{fma}\left(t_0, t_0, e^{b}\right)}
\end{array}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{e^{b} + 1}\\
\end{array}
(FPCore (a b) :precision binary64 (/ (exp a) (+ (exp a) (exp b))))
(FPCore (a b) :precision binary64 (if (<= (exp a) 1.769608985345696e+308) (let* ((t_0 (sqrt (exp a)))) (/ (exp a) (fma t_0 t_0 (exp b)))) (/ 1.0 (+ (exp b) 1.0))))
double code(double a, double b) {
return exp(a) / (exp(a) + exp(b));
}
double code(double a, double b) {
double tmp;
if (exp(a) <= 1.769608985345696e+308) {
double t_0_1 = sqrt(exp(a));
tmp = exp(a) / fma(t_0_1, t_0_1, exp(b));
} else {
tmp = 1.0 / (exp(b) + 1.0);
}
return tmp;
}




Bits error versus a




Bits error versus b
| Original | 0.6 |
|---|---|
| Target | 0.0 |
| Herbie | 0.3 |
if (exp.f64 a) < 1.76960898534569605e308Initial program 0.2
Applied add-sqr-sqrt_binary640.2
Applied fma-def_binary640.2
if 1.76960898534569605e308 < (exp.f64 a) Initial program 64.0
Taylor expanded in a around 0 23.2
Final simplification0.3
herbie shell --seed 2021357
(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))))