Average Error: 40.0 → 0.5
Time: 15.1s
Precision: 64
Internal Precision: 1408
\[\frac{e^{x}}{e^{x} - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.0012813729123724068:\\ \;\;\;\;\frac{e^{x}}{\frac{e^{x + x} - 1}{e^{x} + 1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} + \left(\frac{1}{x} + \frac{1}{12} \cdot x\right)\\ \end{array}\]

Error

Bits error versus x

Target

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

Derivation

  1. Split input into 2 regimes
  2. if x < -0.0012813729123724068

    1. Initial program 0.0

      \[\frac{e^{x}}{e^{x} - 1}\]
    2. Using strategy rm
    3. Applied flip--0.0

      \[\leadsto \frac{e^{x}}{\color{blue}{\frac{e^{x} \cdot e^{x} - 1 \cdot 1}{e^{x} + 1}}}\]
    4. Applied simplify0.0

      \[\leadsto \frac{e^{x}}{\frac{\color{blue}{e^{x + x} - 1}}{e^{x} + 1}}\]

    if -0.0012813729123724068 < x

    1. Initial program 60.2

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

      \[\leadsto \color{blue}{\frac{1}{2} + \left(\frac{1}{x} + \frac{1}{12} \cdot x\right)}\]
  3. Recombined 2 regimes into one program.
  4. Removed slow pow expressions.

Runtime

Time bar (total: 15.1s)Debug logProfile

herbie shell --seed '#(1063282112 2455465480 4141627379 3773598652 1647277307 776739644)' 
(FPCore (x)
  :name "expq2 (section 3.11)"

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

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