Average Error: 40.9 → 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 r106042 = x;
        double r106043 = exp(r106042);
        double r106044 = 1.0;
        double r106045 = r106043 - r106044;
        double r106046 = r106043 / r106045;
        return r106046;
}

double f(double x) {
        double r106047 = x;
        double r106048 = exp(r106047);
        double r106049 = 2.0;
        double r106050 = pow(r106047, r106049);
        double r106051 = 0.16666666666666666;
        double r106052 = r106047 * r106051;
        double r106053 = 0.5;
        double r106054 = r106052 + r106053;
        double r106055 = r106050 * r106054;
        double r106056 = r106055 + r106047;
        double r106057 = r106048 / r106056;
        return r106057;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original40.9
Target40.4
Herbie1.0
\[\frac{1}{1 - e^{-x}}\]

Derivation

  1. Initial program 40.9

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

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

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

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