Average Error: 44.7 → 0.1
Time: 8.7s
Precision: 64
Internal Precision: 1408
\[\frac{e^{x}}{e^{x} - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -7.875172610670247 \cdot 10^{-05}:\\ \;\;\;\;\left(\sqrt[3]{\frac{e^{x}}{e^{x} - 1}} \cdot \sqrt[3]{\frac{e^{x}}{e^{x} - 1}}\right) \cdot \sqrt[3]{\frac{e^{x}}{e^{x} - 1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} + \left(\frac{1}{x} + \frac{1}{12} \cdot x\right)\\ \end{array}\]

Error

Bits error versus x

Target

Original44.7
Target44.7
Herbie0.1
\[\frac{1}{1 - e^{-x}}\]

Derivation

  1. Split input into 2 regimes
  2. if x < -7.875172610670247e-05

    1. Initial program 0.0

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

      \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{e^{x}}{e^{x} - 1}} \cdot \sqrt[3]{\frac{e^{x}}{e^{x} - 1}}\right) \cdot \sqrt[3]{\frac{e^{x}}{e^{x} - 1}}}\]

    if -7.875172610670247e-05 < x

    1. Initial program 60.8

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

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

herbie shell --seed '#(151349756 408087815 228312487 2538703040 1980610373 1250971417)' 
(FPCore (x)
  :name "expq2 (section 3.11)"

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

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