Average Error: 45.4 → 0.0
Time: 10.1s
Precision: 64
Internal precision: 128
\[\frac{e^{x}}{e^{x} - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -5.458497096453193 \cdot 10^{-06}:\\ \;\;\;\;\frac{1}{1 - e^{-x}}\\ \mathbf{if}\;x \le 15.465634390463869:\\ \;\;\;\;\frac{1}{x} + \left(\frac{1}{12} \cdot x + \frac{1}{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{1 - e^{-x}}\\ \end{array}\]

Error

Bits error versus x

Target

Original45.4
Comparison30.1
Herbie0.0
\[ \frac{1}{1 - e^{-x}} \]

Derivation

  1. Split input into 2 regimes.
  2. if x < -5.458497096453193e-06 or 15.465634390463869 < x

    1. Initial program 30.4

      \[\frac{e^{x}}{e^{x} - 1}\]
    2. Using strategy rm
    3. Applied clear-num 30.4

      \[\leadsto \color{blue}{\frac{1}{\frac{e^{x} - 1}{e^{x}}}}\]
    4. Applied simplify 0.1

      \[\leadsto \frac{1}{\color{blue}{1 - e^{-x}}}\]

    if -5.458497096453193e-06 < x < 15.465634390463869

    1. Initial program 60.7

      \[\frac{e^{x}}{e^{x} - 1}\]
    2. Applied taylor 0.0

      \[\leadsto \frac{1}{x} + \left(\frac{1}{12} \cdot x + \frac{1}{2}\right)\]
    3. Taylor expanded around 0 0.0

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

Runtime

Time bar (total: 10.1s) Debug log

Please include this information when filing a bug report:

herbie --seed '#(2056641123 1002655617 1935656572 1439775833 1455146737 3976603290)'
(FPCore (x)
  :name "expq2 (section 3.11)"

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

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