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

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original39.6
Target39.2
Herbie0.5
\[\frac{1}{1 - e^{-x}}\]

Derivation

  1. Split input into 2 regimes
  2. if (exp x) < 0.9984662786877636

    1. Initial program 0.0

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

      \[\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 associate-/r/0.0

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

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

    if 0.9984662786877636 < (exp x)

    1. Initial program 60.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;e^{x} \le 0.9984662786877636:\\ \;\;\;\;\frac{e^{x}}{{\left(e^{x}\right)}^{3} - {1}^{3}} \cdot \left(\left(e^{x} + 1\right) + e^{x + x}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{12} \cdot x + \left(\frac{1}{x} + \frac{1}{2}\right)\\ \end{array}\]

Runtime

Time bar (total: 27.3s)Debug logProfile

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

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

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