Average Error: 45.4 → 0.0
Time: 18.5s
Precision: 64
Internal Precision: 1408
\[\frac{e^{x}}{e^{x} - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.002096270144711905:\\ \;\;\;\;\frac{1}{1 - e^{-x}}\\ \mathbf{if}\;x \le 0.0017641391526904671:\\ \;\;\;\;\frac{1}{2} + \left(\frac{1}{x} + \frac{1}{12} \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{1 - e^{-x}}\\ \end{array}\]

Error

Bits error versus x

Target

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

Derivation

  1. Split input into 2 regimes
  2. if x < -0.002096270144711905 or 0.0017641391526904671 < x

    1. Initial program 30.5

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

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

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

    if -0.002096270144711905 < x < 0.0017641391526904671

    1. Initial program 60.6

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

      \[\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: 18.5s)Debug log

herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o reduce:binary-search
(FPCore (x)
  :name "expq2 (section 3.11)"

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

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