Average Error: 40.6 → 0.8
Time: 13.8s
Precision: 64
\[\frac{e^{x}}{e^{x} - 1}\]
\[\frac{e^{x}}{\mathsf{expm1}\left(x + \left(x + x\right)\right)} \cdot \left(\left(e^{x} + 1\right) + e^{x} \cdot e^{x}\right)\]
\frac{e^{x}}{e^{x} - 1}
\frac{e^{x}}{\mathsf{expm1}\left(x + \left(x + x\right)\right)} \cdot \left(\left(e^{x} + 1\right) + e^{x} \cdot e^{x}\right)
double f(double x) {
        double r3840460 = x;
        double r3840461 = exp(r3840460);
        double r3840462 = 1.0;
        double r3840463 = r3840461 - r3840462;
        double r3840464 = r3840461 / r3840463;
        return r3840464;
}

double f(double x) {
        double r3840465 = x;
        double r3840466 = exp(r3840465);
        double r3840467 = r3840465 + r3840465;
        double r3840468 = r3840465 + r3840467;
        double r3840469 = expm1(r3840468);
        double r3840470 = r3840466 / r3840469;
        double r3840471 = 1.0;
        double r3840472 = r3840466 + r3840471;
        double r3840473 = r3840466 * r3840466;
        double r3840474 = r3840472 + r3840473;
        double r3840475 = r3840470 * r3840474;
        return r3840475;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original40.6
Target40.1
Herbie0.8
\[\frac{1}{1 - e^{-x}}\]

Derivation

  1. Initial program 40.6

    \[\frac{e^{x}}{e^{x} - 1}\]
  2. Using strategy rm
  3. Applied flip3--40.6

    \[\leadsto \frac{e^{x}}{\color{blue}{\frac{{\left(e^{x}\right)}^{3} - {1}^{3}}{e^{x} \cdot e^{x} + \left(1 \cdot 1 + e^{x} \cdot 1\right)}}}\]
  4. Applied associate-/r/40.6

    \[\leadsto \color{blue}{\frac{e^{x}}{{\left(e^{x}\right)}^{3} - {1}^{3}} \cdot \left(e^{x} \cdot e^{x} + \left(1 \cdot 1 + e^{x} \cdot 1\right)\right)}\]
  5. Simplified0.8

    \[\leadsto \color{blue}{\frac{e^{x}}{\mathsf{expm1}\left(x + \left(x + x\right)\right)}} \cdot \left(e^{x} \cdot e^{x} + \left(1 \cdot 1 + e^{x} \cdot 1\right)\right)\]
  6. Final simplification0.8

    \[\leadsto \frac{e^{x}}{\mathsf{expm1}\left(x + \left(x + x\right)\right)} \cdot \left(\left(e^{x} + 1\right) + e^{x} \cdot e^{x}\right)\]

Reproduce

herbie shell --seed 2019134 +o rules:numerics
(FPCore (x)
  :name "expq2 (section 3.11)"

  :herbie-target
  (/ 1 (- 1 (exp (- x))))

  (/ (exp x) (- (exp x) 1)))