Average Error: 41.2 → 1.0
Time: 3.2s
Precision: 64
\[\frac{e^{x}}{e^{x} - 1}\]
\[\frac{e^{x}}{{x}^{2} \cdot \left(x \cdot \frac{1}{6} + \frac{1}{2}\right) + x}\]
\frac{e^{x}}{e^{x} - 1}
\frac{e^{x}}{{x}^{2} \cdot \left(x \cdot \frac{1}{6} + \frac{1}{2}\right) + x}
double f(double x) {
        double r101394 = x;
        double r101395 = exp(r101394);
        double r101396 = 1.0;
        double r101397 = r101395 - r101396;
        double r101398 = r101395 / r101397;
        return r101398;
}

double f(double x) {
        double r101399 = x;
        double r101400 = exp(r101399);
        double r101401 = 2.0;
        double r101402 = pow(r101399, r101401);
        double r101403 = 0.16666666666666666;
        double r101404 = r101399 * r101403;
        double r101405 = 0.5;
        double r101406 = r101404 + r101405;
        double r101407 = r101402 * r101406;
        double r101408 = r101407 + r101399;
        double r101409 = r101400 / r101408;
        return r101409;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original41.2
Target40.8
Herbie1.0
\[\frac{1}{1 - e^{-x}}\]

Derivation

  1. Initial program 41.2

    \[\frac{e^{x}}{e^{x} - 1}\]
  2. Taylor expanded around 0 11.5

    \[\leadsto \frac{e^{x}}{\color{blue}{\frac{1}{2} \cdot {x}^{2} + \left(\frac{1}{6} \cdot {x}^{3} + x\right)}}\]
  3. Simplified1.0

    \[\leadsto \frac{e^{x}}{\color{blue}{{x}^{2} \cdot \left(x \cdot \frac{1}{6} + \frac{1}{2}\right) + x}}\]
  4. Final simplification1.0

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

Reproduce

herbie shell --seed 2020057 
(FPCore (x)
  :name "expq2 (section 3.11)"
  :precision binary64

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

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