Average Error: 39.8 → 0.7
Time: 23.5s
Precision: 64
Internal Precision: 1344
\[\frac{e^{x}}{e^{x} - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.0010706893524879252:\\ \;\;\;\;\left(e^{x} + 1\right) \cdot \frac{e^{x}}{e^{x} \cdot e^{x} - 1}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{x} + \frac{1}{2}\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

Original39.8
Target39.3
Herbie0.7
\[\frac{1}{1 - e^{-x}}\]

Derivation

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

    1. Initial program 0.0

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

      \[\leadsto \frac{e^{x}}{\color{blue}{\frac{e^{x} \cdot e^{x} - 1 \cdot 1}{e^{x} + 1}}}\]
    4. Applied associate-/r/0.0

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

    if -0.0010706893524879252 < x

    1. Initial program 59.9

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

Runtime

Time bar (total: 23.5s)Debug logProfile

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

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

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