Average Error: 40.0 → 1.1
Time: 20.7s
Precision: 64
Internal Precision: 128
\[\frac{e^{x}}{e^{x} - 1}\]
\[\frac{e^{x}}{x + \left(\frac{1}{2} + \frac{1}{6} \cdot x\right) \cdot \left(x \cdot x\right)}\]

Error

Bits error versus x

Target

Original40.0
Target39.5
Herbie1.1
\[\frac{1}{1 - e^{-x}}\]

Derivation

  1. Initial program 40.0

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

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

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

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

Reproduce

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

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

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