Average Error: 40.2 → 0.6
Time: 1.5m
Precision: 64
Internal Precision: 1344
\[\frac{e^{x}}{e^{x} - 1}\]
\[\begin{array}{l} \mathbf{if}\;e^{x} \le 0.9983021854475828:\\ \;\;\;\;\sqrt[3]{{\left(\frac{e^{x}}{e^{x} - 1}\right)}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} + \left(\frac{1}{x} + \frac{1}{12} \cdot 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.2
Target39.8
Herbie0.6
\[\frac{1}{1 - e^{-x}}\]

Derivation

  1. Split input into 2 regimes
  2. if (exp x) < 0.9983021854475828

    1. Initial program 0.0

      \[\frac{e^{x}}{e^{x} - 1}\]
    2. Using strategy rm
    3. Applied add-cbrt-cube0.0

      \[\leadsto \frac{e^{x}}{\color{blue}{\sqrt[3]{\left(\left(e^{x} - 1\right) \cdot \left(e^{x} - 1\right)\right) \cdot \left(e^{x} - 1\right)}}}\]
    4. Applied add-cbrt-cube0.1

      \[\leadsto \frac{\color{blue}{\sqrt[3]{\left(e^{x} \cdot e^{x}\right) \cdot e^{x}}}}{\sqrt[3]{\left(\left(e^{x} - 1\right) \cdot \left(e^{x} - 1\right)\right) \cdot \left(e^{x} - 1\right)}}\]
    5. Applied cbrt-undiv0.1

      \[\leadsto \color{blue}{\sqrt[3]{\frac{\left(e^{x} \cdot e^{x}\right) \cdot e^{x}}{\left(\left(e^{x} - 1\right) \cdot \left(e^{x} - 1\right)\right) \cdot \left(e^{x} - 1\right)}}}\]
    6. Applied simplify0.1

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

    if 0.9983021854475828 < (exp x)

    1. Initial program 60.4

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

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

Runtime

Time bar (total: 1.5m)Debug logProfile

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

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

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