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

Error

Bits error versus x

Target

Original45.2
Comparison45.2
Herbie0.1
\[ \frac{1}{1 - e^{-x}} \]

Derivation

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

    1. Initial program 0.0

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

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

    if -0.00040751132962401493 < 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: 5.3s) Debug logProfile

Please include this information when filing a bug report:

herbie shell --seed '#(1067488128 1186562765 67428877 2948030040 4169093828 3206893112)'
(FPCore (x)
  :name "expq2 (section 3.11)"

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

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