\frac{e^{a}}{e^{a} + e^{b}}e^{a - \log \left(e^{a} + e^{b}\right)}(FPCore (a b) :precision binary64 (/ (exp a) (+ (exp a) (exp b))))
(FPCore (a b) :precision binary64 (exp (- a (log (+ (exp a) (exp b))))))
double code(double a, double b) {
return (((double) exp(a)) / ((double) (((double) exp(a)) + ((double) exp(b)))));
}
double code(double a, double b) {
return ((double) exp(((double) (a - ((double) log(((double) (((double) exp(a)) + ((double) exp(b))))))))));
}




Bits error versus a




Bits error versus b
Results
| Original | 0.7 |
|---|---|
| Target | 0.0 |
| Herbie | 0.5 |
Initial program 0.7
rmApplied add-exp-log_binary640.7
Applied div-exp_binary640.5
Final simplification0.5
herbie shell --seed 2020205
(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))))