Average Error: 40.0 → 0.4
Time: 23.7s
Precision: 64
\[\frac{e^{x}}{e^{x} - 1}\]
\[\frac{e^{x}}{\frac{\mathsf{expm1}\left(x + x\right)}{e^{x} + 1}}\]
\frac{e^{x}}{e^{x} - 1}
\frac{e^{x}}{\frac{\mathsf{expm1}\left(x + x\right)}{e^{x} + 1}}
double f(double x) {
        double r2335679 = x;
        double r2335680 = exp(r2335679);
        double r2335681 = 1.0;
        double r2335682 = r2335680 - r2335681;
        double r2335683 = r2335680 / r2335682;
        return r2335683;
}

double f(double x) {
        double r2335684 = x;
        double r2335685 = exp(r2335684);
        double r2335686 = r2335684 + r2335684;
        double r2335687 = expm1(r2335686);
        double r2335688 = 1.0;
        double r2335689 = r2335685 + r2335688;
        double r2335690 = r2335687 / r2335689;
        double r2335691 = r2335685 / r2335690;
        return r2335691;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original40.0
Target39.7
Herbie0.4
\[\frac{1}{1 - e^{-x}}\]

Derivation

  1. Initial program 40.0

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

    \[\leadsto \frac{e^{x}}{\color{blue}{\frac{e^{x} \cdot e^{x} - 1 \cdot 1}{e^{x} + 1}}}\]
  4. Simplified0.4

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

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

Reproduce

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

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

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