Average Error: 45.5 → 0.0
Time: 14.3s
Precision: 64
Ground Truth: 128
\[\frac{e^{x}}{e^{x} - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -4.436569855739804 \cdot 10^{-07}:\\ \;\;\;\;e^{x} \cdot \frac{1}{e^{x} - 1}\\ \mathbf{if}\;x \le 0.08880936985480982:\\ \;\;\;\;\frac{1}{2} + \left(\frac{1}{12} \cdot x + \frac{1}{x}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{1 - e^{-x}}\\ \end{array}\]

Error

Bits error versus x

Target

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

Derivation

  1. Split input into 3 regimes.
  2. if x < -4.436569855739804e-07

    1. Initial program 0.1

      \[\frac{e^{x}}{e^{x} - 1}\]
    2. Using strategy rm
    3. Applied div-inv 0.1

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

    if -4.436569855739804e-07 < x < 0.08880936985480982

    1. Initial program 60.8

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

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

      \[\leadsto \color{blue}{\frac{1}{2} + \left(\frac{1}{12} \cdot x + \frac{1}{x}\right)}\]

    if 0.08880936985480982 < x

    1. Initial program 61.2

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

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

      \[\leadsto \frac{1}{\color{blue}{1 - e^{-x}}}\]
  3. Recombined 3 regimes into one program.
  4. Removed slow pow expressions

Runtime

Total time: 14.3s Debug log

Please report a bug with the following info:

herbie --seed '#(1570617624 1452639106 4162419203 1378987275 2291276829 4162533703)'
(FPCore (x)
  :name "NMSE section 3.11"

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

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