Average Error: 40.2 → 0.4
Time: 33.4s
Precision: 64
Internal Precision: 1344
\[\frac{e^{x}}{e^{x} - 1}\]
\[\begin{array}{l} \mathbf{if}\;e^{x} \le 0.0012148373248771097 \lor \neg \left(e^{x} \le 1.0000000000051388\right):\\ \;\;\;\;\frac{1}{1 - e^{-x}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{x} + \frac{1}{12} \cdot x\right) + \frac{1}{2}\\ \end{array}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Split input into 2 regimes
  2. if (exp x) < 0.0012148373248771097 or 1.0000000000051388 < (exp x)

    1. Initial program 1.9

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

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

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

    if 0.0012148373248771097 < (exp x) < 1.0000000000051388

    1. Initial program 60.7

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

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

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;e^{x} \le 0.0012148373248771097 \lor \neg \left(e^{x} \le 1.0000000000051388\right):\\ \;\;\;\;\frac{1}{1 - e^{-x}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{x} + \frac{1}{12} \cdot x\right) + \frac{1}{2}\\ \end{array}}\]

Runtime

Time bar (total: 33.4s)Debug logProfile

herbie shell --seed '#(1072967564 1937075727 894099792 790700740 1036514779 1027793188)' 
(FPCore (x)
  :name "expq2 (section 3.11)"

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

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