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

Error

Bits error versus x

Target

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

Derivation

  1. Split input into 2 regimes
  2. if (cbrt (pow (/ (exp x) (expm1 x)) 3)) < -68.58172063229419 or 1711.090160547773 < (cbrt (pow (/ (exp x) (expm1 x)) 3))

    1. Initial program 60.7

      \[\frac{e^{x}}{e^{x} - 1}\]
    2. Applied simplify0.7

      \[\leadsto \color{blue}{\frac{e^{x}}{(e^{x} - 1)^*}}\]
    3. Taylor expanded around 0 0.6

      \[\leadsto \color{blue}{\frac{1}{2} + \left(\frac{1}{x} + \frac{1}{12} \cdot x\right)}\]
    4. Applied simplify0.6

      \[\leadsto \color{blue}{\frac{1}{x} + (\frac{1}{12} \cdot x + \frac{1}{2})_*}\]
    5. Using strategy rm
    6. Applied add-sqr-sqrt0.6

      \[\leadsto \frac{1}{x} + \color{blue}{\sqrt{(\frac{1}{12} \cdot x + \frac{1}{2})_*} \cdot \sqrt{(\frac{1}{12} \cdot x + \frac{1}{2})_*}}\]
    7. Using strategy rm
    8. Applied add-cube-cbrt0.6

      \[\leadsto \frac{1}{x} + \color{blue}{\left(\left(\sqrt[3]{\sqrt{(\frac{1}{12} \cdot x + \frac{1}{2})_*}} \cdot \sqrt[3]{\sqrt{(\frac{1}{12} \cdot x + \frac{1}{2})_*}}\right) \cdot \sqrt[3]{\sqrt{(\frac{1}{12} \cdot x + \frac{1}{2})_*}}\right)} \cdot \sqrt{(\frac{1}{12} \cdot x + \frac{1}{2})_*}\]
    9. Applied associate-*l*0.6

      \[\leadsto \frac{1}{x} + \color{blue}{\left(\sqrt[3]{\sqrt{(\frac{1}{12} \cdot x + \frac{1}{2})_*}} \cdot \sqrt[3]{\sqrt{(\frac{1}{12} \cdot x + \frac{1}{2})_*}}\right) \cdot \left(\sqrt[3]{\sqrt{(\frac{1}{12} \cdot x + \frac{1}{2})_*}} \cdot \sqrt{(\frac{1}{12} \cdot x + \frac{1}{2})_*}\right)}\]
    10. Using strategy rm
    11. Applied add-cube-cbrt0.6

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

    if -68.58172063229419 < (cbrt (pow (/ (exp x) (expm1 x)) 3)) < 1711.090160547773

    1. Initial program 0.0

      \[\frac{e^{x}}{e^{x} - 1}\]
    2. Applied simplify0.0

      \[\leadsto \color{blue}{\frac{e^{x}}{(e^{x} - 1)^*}}\]
    3. Using strategy rm
    4. Applied add-cbrt-cube0.1

      \[\leadsto \frac{e^{x}}{\color{blue}{\sqrt[3]{\left((e^{x} - 1)^* \cdot (e^{x} - 1)^*\right) \cdot (e^{x} - 1)^*}}}\]
    5. Applied add-cbrt-cube0.2

      \[\leadsto \frac{\color{blue}{\sqrt[3]{\left(e^{x} \cdot e^{x}\right) \cdot e^{x}}}}{\sqrt[3]{\left((e^{x} - 1)^* \cdot (e^{x} - 1)^*\right) \cdot (e^{x} - 1)^*}}\]
    6. Applied cbrt-undiv0.2

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

      \[\leadsto \sqrt[3]{\color{blue}{{\left(\frac{e^{x}}{(e^{x} - 1)^*}\right)}^{3}}}\]
  3. Recombined 2 regimes into one program.
  4. Applied simplify0.4

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

Runtime

Time bar (total: 18.5s)Debug logProfile

herbie shell --seed 2018199 +o rules:numerics
(FPCore (x)
  :name "expq2 (section 3.11)"

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

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