Average Error: 40.3 → 0.5
Time: 1.4m
Precision: 64
Internal Precision: 1344
\[\frac{e^{x}}{e^{x} - 1}\]
\[\begin{array}{l} \mathbf{if}\;\frac{1}{1 - e^{-x}} \le 19.066469371829943:\\ \;\;\;\;\frac{1}{1 - e^{-x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{x}}{\frac{1}{2} \cdot {x}^{2} + \left(\frac{1}{6} \cdot {x}^{3} + 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.3
Target39.9
Herbie0.5
\[\frac{1}{1 - e^{-x}}\]

Derivation

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

    1. Initial program 2.2

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

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

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

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

    1. Initial program 61.4

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

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

Runtime

Time bar (total: 1.4m)Debug logProfile

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

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

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