Average Error: 39.5 → 0.4
Time: 11.6s
Precision: 64
\[\frac{e^{x}}{e^{x} - 1}\]
\[e^{x} \cdot \frac{1}{\mathsf{expm1}\left(x\right)}\]
\frac{e^{x}}{e^{x} - 1}
e^{x} \cdot \frac{1}{\mathsf{expm1}\left(x\right)}
double f(double x) {
        double r1690079 = x;
        double r1690080 = exp(r1690079);
        double r1690081 = 1.0;
        double r1690082 = r1690080 - r1690081;
        double r1690083 = r1690080 / r1690082;
        return r1690083;
}

double f(double x) {
        double r1690084 = x;
        double r1690085 = exp(r1690084);
        double r1690086 = 1.0;
        double r1690087 = expm1(r1690084);
        double r1690088 = r1690086 / r1690087;
        double r1690089 = r1690085 * r1690088;
        return r1690089;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original39.5
Target39.2
Herbie0.4
\[\frac{1}{1 - e^{-x}}\]

Derivation

  1. Initial program 39.5

    \[\frac{e^{x}}{e^{x} - 1}\]
  2. Using strategy rm
  3. Applied expm1-log1p-u39.5

    \[\leadsto \frac{e^{x}}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(e^{x} - 1\right)\right)}}\]
  4. Simplified0.4

    \[\leadsto \frac{e^{x}}{\mathsf{expm1}\left(\color{blue}{x}\right)}\]
  5. Using strategy rm
  6. Applied div-inv0.4

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

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

Reproduce

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

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

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