Average Error: 40.2 → 0.7
Time: 31.4s
Precision: 64
Internal Precision: 1344
\[\frac{e^{x}}{e^{x} - 1}\]
\[\begin{array}{l} \mathbf{if}\;\frac{e^{x}}{e^{x} - 1} \le 400.5282577362016:\\ \;\;\;\;\frac{e^{x}}{\frac{{\left(e^{x}\right)}^{3} - 1}{e^{x + x} + \left(e^{x} + 1\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} + \left(\frac{1}{x} + \frac{1}{12} \cdot x\right)\\ \end{array}\]

Error

Bits error versus x

Target

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

Derivation

  1. Split input into 2 regimes
  2. if (/ (exp x) (- (exp x) 1)) < 400.5282577362016

    1. Initial program 1.1

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

      \[\leadsto \frac{e^{x}}{\color{blue}{\frac{{\left(e^{x}\right)}^{3} - {1}^{3}}{e^{x} \cdot e^{x} + \left(1 \cdot 1 + e^{x} \cdot 1\right)}}}\]
    4. Applied simplify1.2

      \[\leadsto \frac{e^{x}}{\frac{\color{blue}{{\left(e^{x}\right)}^{3} - 1}}{e^{x} \cdot e^{x} + \left(1 \cdot 1 + e^{x} \cdot 1\right)}}\]
    5. Applied simplify1.2

      \[\leadsto \frac{e^{x}}{\frac{{\left(e^{x}\right)}^{3} - 1}{\color{blue}{e^{x + x} + \left(e^{x} + 1\right)}}}\]

    if 400.5282577362016 < (/ (exp x) (- (exp x) 1))

    1. Initial program 61.4

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

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

Runtime

Time bar (total: 31.4s)Debug logProfile

herbie shell --seed '#(1072330854 3074818769 591214268 3603999196 3863745332 3332387116)' 
(FPCore (x)
  :name "expq2 (section 3.11)"

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

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