Average Error: 0.7 → 0.6
Time: 3.6s
Precision: binary64
\[\frac{e^{a}}{e^{a} + e^{b}}\]
\[{e}^{\left(a - \log \left(e^{a} + e^{b}\right)\right)}\]
\frac{e^{a}}{e^{a} + e^{b}}
{e}^{\left(a - \log \left(e^{a} + e^{b}\right)\right)}
double code(double a, double b) {
	return ((double) (((double) exp(a)) / ((double) (((double) exp(a)) + ((double) exp(b))))));
}
double code(double a, double b) {
	return ((double) pow(((double) M_E), ((double) (a - ((double) log(((double) (((double) exp(a)) + ((double) exp(b))))))))));
}

Error

Bits error versus a

Bits error versus b

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.7
Target0.0
Herbie0.6
\[\frac{1}{1 + e^{b - a}}\]

Derivation

  1. Initial program 0.7

    \[\frac{e^{a}}{e^{a} + e^{b}}\]
  2. Using strategy rm
  3. Applied add-exp-log0.7

    \[\leadsto \frac{e^{a}}{\color{blue}{e^{\log \left(e^{a} + e^{b}\right)}}}\]
  4. Applied div-exp0.6

    \[\leadsto \color{blue}{e^{a - \log \left(e^{a} + e^{b}\right)}}\]
  5. Using strategy rm
  6. Applied *-un-lft-identity0.6

    \[\leadsto e^{\color{blue}{1 \cdot \left(a - \log \left(e^{a} + e^{b}\right)\right)}}\]
  7. Applied exp-prod0.6

    \[\leadsto \color{blue}{{\left(e^{1}\right)}^{\left(a - \log \left(e^{a} + e^{b}\right)\right)}}\]
  8. Simplified0.6

    \[\leadsto {\color{blue}{e}}^{\left(a - \log \left(e^{a} + e^{b}\right)\right)}\]
  9. Final simplification0.6

    \[\leadsto {e}^{\left(a - \log \left(e^{a} + e^{b}\right)\right)}\]

Reproduce

herbie shell --seed 2020184 
(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))))