Average Error: 39.9 → 0.9
Time: 34.7s
Precision: 64
Internal Precision: 1344
\[\frac{e^{x}}{e^{x} - 1}\]
\[\begin{array}{l} \mathbf{if}\;\frac{e^{x}}{e^{x} - 1} \le 390.8384192731809:\\ \;\;\;\;\frac{1}{\sqrt[3]{e^{x + x} - 1} \cdot \sqrt[3]{e^{x + x} - 1}} \cdot \frac{e^{x} \cdot \left(e^{x} + 1\right)}{\log \left(e^{\sqrt[3]{e^{x + x} - 1}}\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{1}{12} + \left(\frac{1}{2} + \frac{1}{x}\right)\\ \end{array}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original39.9
Target39.5
Herbie0.9
\[\frac{1}{1 - e^{-x}}\]

Derivation

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

    1. Initial program 1.0

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

      \[\leadsto \frac{e^{x}}{e^{x} - 1}\]
    3. Using strategy rm
    4. Applied flip--1.1

      \[\leadsto \frac{e^{x}}{\color{blue}{\frac{e^{x} \cdot e^{x} - 1 \cdot 1}{e^{x} + 1}}}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity1.1

      \[\leadsto \frac{e^{x}}{\frac{e^{x} \cdot e^{x} - 1 \cdot 1}{\color{blue}{1 \cdot \left(e^{x} + 1\right)}}}\]
    7. Applied add-cube-cbrt1.1

      \[\leadsto \frac{e^{x}}{\frac{\color{blue}{\left(\sqrt[3]{e^{x} \cdot e^{x} - 1 \cdot 1} \cdot \sqrt[3]{e^{x} \cdot e^{x} - 1 \cdot 1}\right) \cdot \sqrt[3]{e^{x} \cdot e^{x} - 1 \cdot 1}}}{1 \cdot \left(e^{x} + 1\right)}}\]
    8. Applied times-frac1.1

      \[\leadsto \frac{e^{x}}{\color{blue}{\frac{\sqrt[3]{e^{x} \cdot e^{x} - 1 \cdot 1} \cdot \sqrt[3]{e^{x} \cdot e^{x} - 1 \cdot 1}}{1} \cdot \frac{\sqrt[3]{e^{x} \cdot e^{x} - 1 \cdot 1}}{e^{x} + 1}}}\]
    9. Applied *-un-lft-identity1.1

      \[\leadsto \frac{\color{blue}{1 \cdot e^{x}}}{\frac{\sqrt[3]{e^{x} \cdot e^{x} - 1 \cdot 1} \cdot \sqrt[3]{e^{x} \cdot e^{x} - 1 \cdot 1}}{1} \cdot \frac{\sqrt[3]{e^{x} \cdot e^{x} - 1 \cdot 1}}{e^{x} + 1}}\]
    10. Applied times-frac1.1

      \[\leadsto \color{blue}{\frac{1}{\frac{\sqrt[3]{e^{x} \cdot e^{x} - 1 \cdot 1} \cdot \sqrt[3]{e^{x} \cdot e^{x} - 1 \cdot 1}}{1}} \cdot \frac{e^{x}}{\frac{\sqrt[3]{e^{x} \cdot e^{x} - 1 \cdot 1}}{e^{x} + 1}}}\]
    11. Simplified1.0

      \[\leadsto \color{blue}{\frac{1}{\sqrt[3]{e^{x + x} - 1} \cdot \sqrt[3]{e^{x + x} - 1}}} \cdot \frac{e^{x}}{\frac{\sqrt[3]{e^{x} \cdot e^{x} - 1 \cdot 1}}{e^{x} + 1}}\]
    12. Simplified1.0

      \[\leadsto \frac{1}{\sqrt[3]{e^{x + x} - 1} \cdot \sqrt[3]{e^{x + x} - 1}} \cdot \color{blue}{\frac{\left(1 + e^{x}\right) \cdot e^{x}}{\sqrt[3]{e^{x + x} - 1}}}\]
    13. Using strategy rm
    14. Applied add-log-exp1.4

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

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

    1. Initial program 61.5

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

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

      \[\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.9

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

Runtime

Time bar (total: 34.7s)Debug logProfile

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

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

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