Average Error: 41.2 → 0.9
Time: 12.3s
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 r82195 = x;
        double r82196 = exp(r82195);
        double r82197 = 1.0;
        double r82198 = r82196 - r82197;
        double r82199 = r82196 / r82198;
        return r82199;
}

double f(double x) {
        double r82200 = x;
        double r82201 = exp(r82200);
        double r82202 = 2.0;
        double r82203 = pow(r82200, r82202);
        double r82204 = 0.16666666666666666;
        double r82205 = r82200 * r82204;
        double r82206 = 0.5;
        double r82207 = r82205 + r82206;
        double r82208 = r82203 * r82207;
        double r82209 = r82208 + r82200;
        double r82210 = r82201 / r82209;
        return r82210;
}

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.9

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

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

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