Average Error: 41.8 → 1.0
Time: 2.7s
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 r58357 = x;
        double r58358 = exp(r58357);
        double r58359 = 1.0;
        double r58360 = r58358 - r58359;
        double r58361 = r58358 / r58360;
        return r58361;
}

double f(double x) {
        double r58362 = x;
        double r58363 = exp(r58362);
        double r58364 = 2.0;
        double r58365 = pow(r58362, r58364);
        double r58366 = 0.16666666666666666;
        double r58367 = r58362 * r58366;
        double r58368 = 0.5;
        double r58369 = r58367 + r58368;
        double r58370 = r58365 * r58369;
        double r58371 = r58370 + r58362;
        double r58372 = r58363 / r58371;
        return r58372;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 41.8

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

    \[\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 2020083 
(FPCore (x)
  :name "expq2 (section 3.11)"
  :precision binary64

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

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