Average Error: 41.2 → 0.9
Time: 10.4s
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 r75442 = x;
        double r75443 = exp(r75442);
        double r75444 = 1.0;
        double r75445 = r75443 - r75444;
        double r75446 = r75443 / r75445;
        return r75446;
}

double f(double x) {
        double r75447 = x;
        double r75448 = exp(r75447);
        double r75449 = 2.0;
        double r75450 = pow(r75447, r75449);
        double r75451 = 0.16666666666666666;
        double r75452 = r75447 * r75451;
        double r75453 = 0.5;
        double r75454 = r75452 + r75453;
        double r75455 = r75450 * r75454;
        double r75456 = r75455 + r75447;
        double r75457 = r75448 / r75456;
        return r75457;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original41.2
Target40.9
Herbie0.9
\[\frac{1}{1 - e^{-x}}\]

Derivation

  1. Initial program 41.2

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

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

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

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

Reproduce

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

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

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