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

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Split input into 2 regimes
  2. if (/ (- (exp x)) (- 1 (exp x))) < -0.055826681054801125 or 315.02294367585023 < (/ (- (exp x)) (- 1 (exp x)))

    1. Initial program 60.1

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

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

    if -0.055826681054801125 < (/ (- (exp x)) (- 1 (exp x))) < 315.02294367585023

    1. Initial program 0.0

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

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

      \[\leadsto \frac{-e^{x}}{\color{blue}{1 - e^{x}}}\]
  3. Recombined 2 regimes into one program.

Runtime

Time bar (total: 17.7s)Debug logProfile

herbie shell --seed 2018296 
(FPCore (x)
  :name "expq2 (section 3.11)"

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

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