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

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original39.6
Target38.7
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 (+ (* 1/2 x) (+ (* 1/6 (pow x 2)) 1)) < 1.0001974428943352

    1. Initial program 60.1

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

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

    if 1.0001974428943352 < (+ (* 1/2 x) (+ (* 1/6 (pow x 2)) 1))

    1. Initial program 0.0

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

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{e^{x} - 1} \cdot \sqrt[3]{e^{x} - 1}\right) \cdot \sqrt[3]{e^{x} - 1}}}{x}\]
    4. Applied associate-/l*0.1

      \[\leadsto \color{blue}{\frac{\sqrt[3]{e^{x} - 1} \cdot \sqrt[3]{e^{x} - 1}}{\frac{x}{\sqrt[3]{e^{x} - 1}}}}\]
    5. Using strategy rm
    6. Applied add-log-exp0.4

      \[\leadsto \frac{\sqrt[3]{e^{x} - 1} \cdot \sqrt[3]{\color{blue}{\log \left(e^{e^{x} - 1}\right)}}}{\frac{x}{\sqrt[3]{e^{x} - 1}}}\]
    7. Using strategy rm
    8. Applied flip--0.4

      \[\leadsto \frac{\sqrt[3]{e^{x} - 1} \cdot \sqrt[3]{\log \left(e^{e^{x} - 1}\right)}}{\frac{x}{\sqrt[3]{\color{blue}{\frac{e^{x} \cdot e^{x} - 1 \cdot 1}{e^{x} + 1}}}}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.3

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

Runtime

Time bar (total: 12.4s)Debug logProfile

herbie shell --seed 2018225 
(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))