Average Error: 39.2 → 0.3
Time: 54.7s
Precision: 64
Internal Precision: 1344
\[\frac{e^{x} - 1}{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.00011744894398450065:\\ \;\;\;\;\frac{\frac{{\left(e^{\sqrt[3]{x + x} \cdot \sqrt[3]{x + x}}\right)}^{\left(\sqrt[3]{x + x} + \sqrt[3]{x + x}\right)} - 1}{\left(1 + e^{x + x}\right) \cdot \left(e^{x} + 1\right)}}{x}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \frac{1}{2} + 1\right) + \frac{1}{6} \cdot {x}^{2}\\ \end{array}\]

Error

Bits error versus x

Target

Original39.2
Target38.4
Herbie0.3
\[\begin{array}{l} \mathbf{if}\;x \lt 1 \land x \gt -1:\\ \;\;\;\;\frac{e^{x} - 1}{\log \left(e^{x}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{x} - 1}{x}\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if x < -0.00011744894398450065

    1. Initial program 0.1

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

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

      \[\leadsto \frac{\frac{\color{blue}{e^{x + x} - 1}}{e^{x} + 1}}{x}\]
    5. Using strategy rm
    6. Applied flip--0.0

      \[\leadsto \frac{\frac{\color{blue}{\frac{e^{x + x} \cdot e^{x + x} - 1 \cdot 1}{e^{x + x} + 1}}}{e^{x} + 1}}{x}\]
    7. Applied associate-/l/0.0

      \[\leadsto \frac{\color{blue}{\frac{e^{x + x} \cdot e^{x + x} - 1 \cdot 1}{\left(e^{x} + 1\right) \cdot \left(e^{x + x} + 1\right)}}}{x}\]
    8. Using strategy rm
    9. Applied add-cube-cbrt0.0

      \[\leadsto \frac{\frac{e^{x + x} \cdot e^{\color{blue}{\left(\sqrt[3]{x + x} \cdot \sqrt[3]{x + x}\right) \cdot \sqrt[3]{x + x}}} - 1 \cdot 1}{\left(e^{x} + 1\right) \cdot \left(e^{x + x} + 1\right)}}{x}\]
    10. Applied exp-prod0.0

      \[\leadsto \frac{\frac{e^{x + x} \cdot \color{blue}{{\left(e^{\sqrt[3]{x + x} \cdot \sqrt[3]{x + x}}\right)}^{\left(\sqrt[3]{x + x}\right)}} - 1 \cdot 1}{\left(e^{x} + 1\right) \cdot \left(e^{x + x} + 1\right)}}{x}\]
    11. Applied add-cube-cbrt0.0

      \[\leadsto \frac{\frac{e^{\color{blue}{\left(\sqrt[3]{x + x} \cdot \sqrt[3]{x + x}\right) \cdot \sqrt[3]{x + x}}} \cdot {\left(e^{\sqrt[3]{x + x} \cdot \sqrt[3]{x + x}}\right)}^{\left(\sqrt[3]{x + x}\right)} - 1 \cdot 1}{\left(e^{x} + 1\right) \cdot \left(e^{x + x} + 1\right)}}{x}\]
    12. Applied exp-prod0.0

      \[\leadsto \frac{\frac{\color{blue}{{\left(e^{\sqrt[3]{x + x} \cdot \sqrt[3]{x + x}}\right)}^{\left(\sqrt[3]{x + x}\right)}} \cdot {\left(e^{\sqrt[3]{x + x} \cdot \sqrt[3]{x + x}}\right)}^{\left(\sqrt[3]{x + x}\right)} - 1 \cdot 1}{\left(e^{x} + 1\right) \cdot \left(e^{x + x} + 1\right)}}{x}\]
    13. Applied pow-prod-up0.0

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

    if -0.00011744894398450065 < x

    1. Initial program 59.9

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

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

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;x \le -0.00011744894398450065:\\ \;\;\;\;\frac{\frac{{\left(e^{\sqrt[3]{x + x} \cdot \sqrt[3]{x + x}}\right)}^{\left(\sqrt[3]{x + x} + \sqrt[3]{x + x}\right)} - 1}{\left(1 + e^{x + x}\right) \cdot \left(e^{x} + 1\right)}}{x}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \frac{1}{2} + 1\right) + \frac{1}{6} \cdot {x}^{2}\\ \end{array}}\]

Runtime

Time bar (total: 54.7s)Debug logProfile

herbie shell --seed '#(1071821486 549052472 3784827256 1559736200 3548510075 881134285)' 
(FPCore (x)
  :name "Kahan's exp quotient"

  :herbie-target
  (if (and (< x 1) (> x -1)) (/ (- (exp x) 1) (log (exp x))) (/ (- (exp x) 1) x))

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