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

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

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

    1. Initial program 1.2

      \[\frac{e^{x}}{e^{x} - 1}\]
    2. Initial simplification1.2

      \[\leadsto \frac{e^{x}}{e^{x} - 1}\]
    3. Using strategy rm
    4. Applied flip--1.3

      \[\leadsto \frac{e^{x}}{\color{blue}{\frac{e^{x} \cdot e^{x} - 1 \cdot 1}{e^{x} + 1}}}\]
    5. Taylor expanded around -inf 1.3

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

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

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

    1. Initial program 61.4

      \[\frac{e^{x}}{e^{x} - 1}\]
    2. Initial simplification61.4

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

      \[\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.7

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

Runtime

Time bar (total: 31.3s)Debug logProfile

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

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

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