Average Error: 40.4 → 0.9
Time: 27.4s
Precision: 64
\[\frac{e^{x}}{e^{x} - 1}\]
\[\frac{e^{x}}{x + x \cdot \left(\left(x \cdot \frac{1}{6} + \frac{1}{2}\right) \cdot x\right)}\]
\frac{e^{x}}{e^{x} - 1}
\frac{e^{x}}{x + x \cdot \left(\left(x \cdot \frac{1}{6} + \frac{1}{2}\right) \cdot x\right)}
double f(double x) {
        double r3073357 = x;
        double r3073358 = exp(r3073357);
        double r3073359 = 1.0;
        double r3073360 = r3073358 - r3073359;
        double r3073361 = r3073358 / r3073360;
        return r3073361;
}

double f(double x) {
        double r3073362 = x;
        double r3073363 = exp(r3073362);
        double r3073364 = 0.16666666666666666;
        double r3073365 = r3073362 * r3073364;
        double r3073366 = 0.5;
        double r3073367 = r3073365 + r3073366;
        double r3073368 = r3073367 * r3073362;
        double r3073369 = r3073362 * r3073368;
        double r3073370 = r3073362 + r3073369;
        double r3073371 = r3073363 / r3073370;
        return r3073371;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original40.4
Target40.0
Herbie0.9
\[\frac{1}{1 - e^{-x}}\]

Derivation

  1. Initial program 40.4

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

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

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

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

Reproduce

herbie shell --seed 2019149 
(FPCore (x)
  :name "expq2 (section 3.11)"

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

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