Average Error: 41.1 → 1.0
Time: 3.1s
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 r104751 = x;
        double r104752 = exp(r104751);
        double r104753 = 1.0;
        double r104754 = r104752 - r104753;
        double r104755 = r104752 / r104754;
        return r104755;
}

double f(double x) {
        double r104756 = x;
        double r104757 = exp(r104756);
        double r104758 = 2.0;
        double r104759 = pow(r104756, r104758);
        double r104760 = 0.16666666666666666;
        double r104761 = r104756 * r104760;
        double r104762 = 0.5;
        double r104763 = r104761 + r104762;
        double r104764 = r104759 * r104763;
        double r104765 = r104764 + r104756;
        double r104766 = r104757 / r104765;
        return r104766;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 41.1

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

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

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

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