Average Error: 45.5 → 0.0
Time: 56.1s
Precision: 64
Internal Precision: 1408
\[\frac{e^{x}}{e^{x} - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.004828781430114 \cdot 10^{-05}:\\ \;\;\;\;\frac{e^{x}}{\frac{e^{x + x} - 1}{e^{x} + 1}}\\ \mathbf{if}\;x \le 2.4715167052982148:\\ \;\;\;\;\frac{1}{2} + \left(\frac{1}{x} + \frac{1}{12} \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{1 - e^{-x}}\\ \end{array}\]

Error

Bits error versus x

Target

Original45.5
Target29.9
Herbie0.0
\[\frac{1}{1 - e^{-x}}\]

Derivation

  1. Split input into 3 regimes
  2. if x < -1.004828781430114e-05

    1. Initial program 0.1

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

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

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

    if -1.004828781430114e-05 < x < 2.4715167052982148

    1. Initial program 60.8

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

      \[\leadsto \color{blue}{\frac{1}{2} + \left(\frac{1}{x} + \frac{1}{12} \cdot x\right)}\]

    if 2.4715167052982148 < x

    1. Initial program 61.5

      \[\frac{e^{x}}{e^{x} - 1}\]
    2. Using strategy rm
    3. Applied clear-num61.5

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

      \[\leadsto \frac{1}{\color{blue}{1 - e^{-x}}}\]
  3. Recombined 3 regimes into one program.
  4. Removed slow pow expressions.

Runtime

Time bar (total: 56.1s)Debug logProfile

herbie shell --seed '#(1062900086 561157142 2241869825 1166610429 2484609072 2159574644)' 
(FPCore (x)
  :name "expq2 (section 3.11)"

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

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