Average Error: 39.5 → 0.8
Time: 15.9s
Precision: 64
Internal Precision: 1344
\[\frac{e^{x}}{e^{x} - 1}\]
\[\begin{array}{l} \mathbf{if}\;\frac{e^{x}}{e^{x} - 1} \le 2.4656911013235607:\\ \;\;\;\;\frac{-e^{x}}{1 - e^{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} + \left(\frac{1}{x} + \frac{1}{12} \cdot x\right)\\ \end{array}\]

Error

Bits error versus x

Target

Original39.5
Target39.2
Herbie0.8
\[\frac{1}{1 - e^{-x}}\]

Derivation

  1. Split input into 2 regimes
  2. if (/ (exp x) (- (exp x) 1)) < 2.4656911013235607

    1. Initial program 1.3

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

      \[\leadsto \color{blue}{\frac{-e^{x}}{-\left(e^{x} - 1\right)}}\]
    4. Applied simplify1.3

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

    if 2.4656911013235607 < (/ (exp x) (- (exp x) 1))

    1. Initial program 61.2

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

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

Runtime

Time bar (total: 15.9s)Debug logProfile

herbie shell --seed '#(1071821486 549052472 3784827256 1559736200 3548510075 881134285)' 
(FPCore (x)
  :name "expq2 (section 3.11)"

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

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