Average Error: 39.4 → 0.3
Time: 36.7s
Precision: 64
Internal Precision: 128
\[\frac{e^{x} - 1}{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.00015286969624794689:\\ \;\;\;\;\frac{e^{x} - 1}{x}\\ \mathbf{else}:\\ \;\;\;\;\log \left(e^{\left(x \cdot x\right) \cdot \frac{1}{6} + \left(\frac{1}{2} \cdot x + 1\right)}\right)\\ \end{array}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original39.4
Target38.6
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.00015286969624794689

    1. Initial program 0.1

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

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

    if -0.00015286969624794689 < x

    1. Initial program 60.1

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

      \[\leadsto \color{blue}{\frac{1}{2} \cdot x + \left(\frac{1}{6} \cdot {x}^{2} + 1\right)}\]
    3. Using strategy rm
    4. Applied add-log-exp0.4

      \[\leadsto \frac{1}{2} \cdot x + \color{blue}{\log \left(e^{\frac{1}{6} \cdot {x}^{2} + 1}\right)}\]
    5. Applied add-log-exp0.4

      \[\leadsto \color{blue}{\log \left(e^{\frac{1}{2} \cdot x}\right)} + \log \left(e^{\frac{1}{6} \cdot {x}^{2} + 1}\right)\]
    6. Applied sum-log0.4

      \[\leadsto \color{blue}{\log \left(e^{\frac{1}{2} \cdot x} \cdot e^{\frac{1}{6} \cdot {x}^{2} + 1}\right)}\]
    7. Simplified0.4

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

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

Reproduce

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