Average Error: 44.8 → 0.1
Time: 15.2s
Precision: 64
Internal precision: 1408
\[\frac{e^{x}}{e^{x} - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.00023767617918960045:\\ \;\;\;\;\frac{e^{x}}{\frac{{\left(e^{x}\right)}^3 - 1}{\left(e^{x} + 1\right) + {\left(e^{x}\right)}^2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} + \left(\frac{1}{x} + \frac{1}{12} \cdot x\right)\\ \end{array}\]

Error

Bits error versus x

Target

Original44.8
Comparison44.8
Herbie0.1
\[ \frac{1}{1 - e^{-x}} \]

Derivation

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

    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}}{{\left(e^{x}\right)}^2 + \left({1}^2 + e^{x} \cdot 1\right)}}}\]
    4. Applied simplify 0.0

      \[\leadsto \frac{e^{x}}{\frac{\color{blue}{{\left(e^{x}\right)}^3 - 1}}{{\left(e^{x}\right)}^2 + \left({1}^2 + e^{x} \cdot 1\right)}}\]
    5. Applied simplify 0.0

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

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

    if -0.00023767617918960045 < x

    1. Initial program 60.4

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

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

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

Runtime

Time bar (total: 15.2s) Debug log

Please include this information when filing a bug report:

herbie shell --seed '#(644180380 3784176976 401987740 22459203 1940947670 3323606534)'
(FPCore (x)
  :name "expq2 (section 3.11)"

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

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