Average Error: 41.4 → 1.0
Time: 2.6s
Precision: binary64
\[\frac{e^{x}}{e^{x} - 1}\]
\[\frac{e^{x}}{x + x \cdot \left(x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)}\]
\frac{e^{x}}{e^{x} - 1}
\frac{e^{x}}{x + x \cdot \left(x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)}
double code(double x) {
	return (((double) exp(x)) / ((double) (((double) exp(x)) - 1.0)));
}
double code(double x) {
	return (((double) exp(x)) / ((double) (x + ((double) (x * ((double) (x * ((double) (0.5 + ((double) (x * 0.16666666666666666)))))))))));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original41.4
Target41.0
Herbie1.0
\[\frac{1}{1 - e^{-x}}\]

Derivation

  1. Initial program 41.4

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

    \[\leadsto \frac{e^{x}}{\color{blue}{0.5 \cdot {x}^{2} + \left(0.16666666666666666 \cdot {x}^{3} + x\right)}}\]
  3. Simplified1.0

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

    \[\leadsto \frac{e^{x}}{x + x \cdot \left(x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)}\]

Reproduce

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

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

  (/ (exp x) (- (exp x) 1.0)))