\frac{e^{a}}{e^{a} + e^{b}}e^{\mathsf{fma}\left(\sqrt[3]{a} \cdot \sqrt[3]{a}, \sqrt[3]{a}, -\log \left(e^{a} + e^{b}\right)\right)}double f(double a, double b) {
double r2247798 = a;
double r2247799 = exp(r2247798);
double r2247800 = b;
double r2247801 = exp(r2247800);
double r2247802 = r2247799 + r2247801;
double r2247803 = r2247799 / r2247802;
return r2247803;
}
double f(double a, double b) {
double r2247804 = a;
double r2247805 = cbrt(r2247804);
double r2247806 = r2247805 * r2247805;
double r2247807 = exp(r2247804);
double r2247808 = b;
double r2247809 = exp(r2247808);
double r2247810 = r2247807 + r2247809;
double r2247811 = log(r2247810);
double r2247812 = -r2247811;
double r2247813 = fma(r2247806, r2247805, r2247812);
double r2247814 = exp(r2247813);
return r2247814;
}




Bits error versus a




Bits error versus b
| Original | 0.7 |
|---|---|
| Target | 0.0 |
| Herbie | 0.6 |
Initial program 0.7
rmApplied add-exp-log0.7
Applied div-exp0.6
rmApplied add-cube-cbrt0.6
Applied fma-neg0.6
Final simplification0.6
herbie shell --seed 2019156 +o rules:numerics
(FPCore (a b)
:name "Quotient of sum of exps"
:herbie-target
(/ 1 (+ 1 (exp (- b a))))
(/ (exp a) (+ (exp a) (exp b))))