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

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Split input into 2 regimes
  2. if x < -0.0018581611268275176

    1. Initial program 0.0

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

      \[\leadsto \frac{e^{x}}{e^{x} - 1}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity0.0

      \[\leadsto \frac{\color{blue}{1 \cdot e^{x}}}{e^{x} - 1}\]
    5. Applied associate-/l*0.0

      \[\leadsto \color{blue}{\frac{1}{\frac{e^{x} - 1}{e^{x}}}}\]
    6. Using strategy rm
    7. Applied div-inv0.0

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

    if -0.0018581611268275176 < x

    1. Initial program 60.2

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

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

      \[\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}\;x \le -0.0018581611268275176:\\ \;\;\;\;\frac{1}{\left(e^{x} - 1\right) \cdot \frac{1}{e^{x}}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{2} + \frac{1}{x}\right) + \frac{1}{12} \cdot x\\ \end{array}\]

Runtime

Time bar (total: 14.2s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes21.20.70.021.297%
herbie shell --seed 2018340 
(FPCore (x)
  :name "expq2 (section 3.11)"

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

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