Average Error: 40.0 → 0.9
Time: 14.3s
Precision: 64
\[\frac{e^{x}}{e^{x} - 1}\]
\[\frac{e^{x}}{x + x \cdot \left(\left(x \cdot \frac{1}{6} + \frac{1}{2}\right) \cdot x\right)}\]
\frac{e^{x}}{e^{x} - 1}
\frac{e^{x}}{x + x \cdot \left(\left(x \cdot \frac{1}{6} + \frac{1}{2}\right) \cdot x\right)}
double f(double x) {
        double r2609766 = x;
        double r2609767 = exp(r2609766);
        double r2609768 = 1.0;
        double r2609769 = r2609767 - r2609768;
        double r2609770 = r2609767 / r2609769;
        return r2609770;
}

double f(double x) {
        double r2609771 = x;
        double r2609772 = exp(r2609771);
        double r2609773 = 0.16666666666666666;
        double r2609774 = r2609771 * r2609773;
        double r2609775 = 0.5;
        double r2609776 = r2609774 + r2609775;
        double r2609777 = r2609776 * r2609771;
        double r2609778 = r2609771 * r2609777;
        double r2609779 = r2609771 + r2609778;
        double r2609780 = r2609772 / r2609779;
        return r2609780;
}

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.9
\[\frac{1}{1 - e^{-x}}\]

Derivation

  1. Initial program 40.0

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

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

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

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

Reproduce

herbie shell --seed 2019146 
(FPCore (x)
  :name "expq2 (section 3.11)"

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

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