Average Error: 41.6 → 0.9
Time: 3.5s
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 r60695 = x;
        double r60696 = exp(r60695);
        double r60697 = 1.0;
        double r60698 = r60696 - r60697;
        double r60699 = r60696 / r60698;
        return r60699;
}

double f(double x) {
        double r60700 = x;
        double r60701 = exp(r60700);
        double r60702 = 2.0;
        double r60703 = pow(r60700, r60702);
        double r60704 = 0.16666666666666666;
        double r60705 = r60700 * r60704;
        double r60706 = 0.5;
        double r60707 = r60705 + r60706;
        double r60708 = r60703 * r60707;
        double r60709 = r60708 + r60700;
        double r60710 = r60701 / r60709;
        return r60710;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 41.6

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

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

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

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