Average Error: 0.6 → 0.6
Time: 14.8s
Precision: 64
\[\frac{e^{a}}{e^{a} + e^{b}}\]
\[e^{a} \cdot \frac{1}{e^{b} + e^{a}}\]
\frac{e^{a}}{e^{a} + e^{b}}
e^{a} \cdot \frac{1}{e^{b} + e^{a}}
double f(double a, double b) {
        double r130192 = a;
        double r130193 = exp(r130192);
        double r130194 = b;
        double r130195 = exp(r130194);
        double r130196 = r130193 + r130195;
        double r130197 = r130193 / r130196;
        return r130197;
}

double f(double a, double b) {
        double r130198 = a;
        double r130199 = exp(r130198);
        double r130200 = 1.0;
        double r130201 = b;
        double r130202 = exp(r130201);
        double r130203 = r130202 + r130199;
        double r130204 = r130200 / r130203;
        double r130205 = r130199 * r130204;
        return r130205;
}

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.6
Target0.0
Herbie0.6
\[\frac{1}{1 + e^{b - a}}\]

Derivation

  1. Initial program 0.6

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

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

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

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

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

    \[\leadsto e^{a} \cdot \color{blue}{\frac{1}{e^{b} + e^{a}}}\]
  9. Final simplification0.6

    \[\leadsto e^{a} \cdot \frac{1}{e^{b} + e^{a}}\]

Reproduce

herbie shell --seed 2019323 
(FPCore (a b)
  :name "Quotient of sum of exps"
  :precision binary64

  :herbie-target
  (/ 1 (+ 1 (exp (- b a))))

  (/ (exp a) (+ (exp a) (exp b))))