Average Error: 41.2 → 1.0
Time: 17.9s
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 r73811 = x;
        double r73812 = exp(r73811);
        double r73813 = 1.0;
        double r73814 = r73812 - r73813;
        double r73815 = r73812 / r73814;
        return r73815;
}

double f(double x) {
        double r73816 = x;
        double r73817 = exp(r73816);
        double r73818 = 2.0;
        double r73819 = pow(r73816, r73818);
        double r73820 = 0.16666666666666666;
        double r73821 = r73820 * r73816;
        double r73822 = 0.5;
        double r73823 = r73821 + r73822;
        double r73824 = r73819 * r73823;
        double r73825 = r73824 + r73816;
        double r73826 = r73817 / r73825;
        return r73826;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original41.2
Target40.8
Herbie1.0
\[\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.0

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

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

Reproduce

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

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

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