Average Error: 41.2 → 1.1
Time: 10.4s
Precision: 64
\[\frac{e^{x}}{e^{x} - 1}\]
\[\frac{e^{x}}{{x}^{2} \cdot \left(\frac{1}{6} \cdot x + \frac{1}{2}\right) + x}\]
\frac{e^{x}}{e^{x} - 1}
\frac{e^{x}}{{x}^{2} \cdot \left(\frac{1}{6} \cdot x + \frac{1}{2}\right) + x}
double f(double x) {
        double r73242 = x;
        double r73243 = exp(r73242);
        double r73244 = 1.0;
        double r73245 = r73243 - r73244;
        double r73246 = r73243 / r73245;
        return r73246;
}

double f(double x) {
        double r73247 = x;
        double r73248 = exp(r73247);
        double r73249 = 2.0;
        double r73250 = pow(r73247, r73249);
        double r73251 = 0.16666666666666666;
        double r73252 = r73251 * r73247;
        double r73253 = 0.5;
        double r73254 = r73252 + r73253;
        double r73255 = r73250 * r73254;
        double r73256 = r73255 + r73247;
        double r73257 = r73248 / r73256;
        return r73257;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 41.2

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

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

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

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

Reproduce

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

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

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