Average Error: 0.8 → 0.0
Time: 20.4s
Precision: 64
\[\frac{e^{a}}{e^{a} + e^{b}}\]
\[\frac{1}{1 + e^{b - a}}\]
\frac{e^{a}}{e^{a} + e^{b}}
\frac{1}{1 + e^{b - a}}
double f(double a, double b) {
        double r110750 = a;
        double r110751 = exp(r110750);
        double r110752 = b;
        double r110753 = exp(r110752);
        double r110754 = r110751 + r110753;
        double r110755 = r110751 / r110754;
        return r110755;
}

double f(double a, double b) {
        double r110756 = 1.0;
        double r110757 = b;
        double r110758 = a;
        double r110759 = r110757 - r110758;
        double r110760 = exp(r110759);
        double r110761 = r110756 + r110760;
        double r110762 = r110756 / r110761;
        return r110762;
}

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

Derivation

  1. Initial program 0.8

    \[\frac{e^{a}}{e^{a} + e^{b}}\]
  2. Using strategy rm
  3. Applied clear-num0.8

    \[\leadsto \color{blue}{\frac{1}{\frac{e^{a} + e^{b}}{e^{a}}}}\]
  4. Simplified0.8

    \[\leadsto \frac{1}{\color{blue}{\frac{e^{b} + e^{a}}{e^{a}}}}\]
  5. Using strategy rm
  6. Applied clear-num0.8

    \[\leadsto \color{blue}{\frac{1}{\frac{\frac{e^{b} + e^{a}}{e^{a}}}{1}}}\]
  7. Simplified0.0

    \[\leadsto \frac{1}{\color{blue}{1 + e^{b - a}}}\]
  8. Final simplification0.0

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

Reproduce

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

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

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