Average Error: 0.7 → 0.7
Time: 33.4s
Precision: 64
\[\frac{e^{a}}{e^{a} + e^{b}}\]
\[\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{e^{a}}{e^{b} + e^{a}}\right)\right)\]
\frac{e^{a}}{e^{a} + e^{b}}
\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{e^{a}}{e^{b} + e^{a}}\right)\right)
double f(double a, double b) {
        double r5776670 = a;
        double r5776671 = exp(r5776670);
        double r5776672 = b;
        double r5776673 = exp(r5776672);
        double r5776674 = r5776671 + r5776673;
        double r5776675 = r5776671 / r5776674;
        return r5776675;
}

double f(double a, double b) {
        double r5776676 = a;
        double r5776677 = exp(r5776676);
        double r5776678 = b;
        double r5776679 = exp(r5776678);
        double r5776680 = r5776679 + r5776677;
        double r5776681 = r5776677 / r5776680;
        double r5776682 = expm1(r5776681);
        double r5776683 = log1p(r5776682);
        return r5776683;
}

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.7
\[\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 log1p-expm1-u0.7

    \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{e^{a}}{e^{a} + e^{b}}\right)\right)}\]
  4. Final simplification0.7

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{e^{a}}{e^{b} + e^{a}}\right)\right)\]

Reproduce

herbie shell --seed 2019200 +o rules:numerics
(FPCore (a b)
  :name "Quotient of sum of exps"

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

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