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

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

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

    1. Initial program 2.3

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

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

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

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

    1. Initial program 61.1

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

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

Runtime

Time bar (total: 10.6s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)' 
(FPCore (x)
  :name "exp(x)/(exp(x)-1)"
  (/ (exp x) (- (exp x) 1)))