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

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 41.5

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

    \[\leadsto \frac{e^{x}}{\color{blue}{x + 0.5 \cdot {x}^{2}}}\]
  3. Simplified1.1

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

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

Reproduce

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

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

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