Average Error: 40.1 → 0.5
Time: 27.4s
Precision: 64
Internal Precision: 1344
\[\frac{e^{x}}{e^{x} - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.0017384240571605481:\\ \;\;\;\;\frac{e^{x}}{{\left(e^{x}\right)}^{3} - {1}^{3}} \cdot \left(\left(e^{x} + 1\right) + e^{x + x}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{x} + \frac{1}{2}\right) + \left(\sqrt[3]{\frac{1}{12} \cdot x} \cdot \sqrt[3]{\frac{1}{12} \cdot x}\right) \cdot \sqrt[3]{\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.1
Target39.7
Herbie0.5
\[\frac{1}{1 - e^{-x}}\]

Derivation

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

    1. Initial program 0.0

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

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

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

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

    if -0.0017384240571605481 < x

    1. Initial program 60.3

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

      \[\leadsto \color{blue}{\frac{1}{12} \cdot x + \left(\frac{1}{x} + \frac{1}{2}\right)}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt0.8

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

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

Runtime

Time bar (total: 27.4s)Debug logProfile

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

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

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