Average Error: 40.0 → 0.2
Time: 39.8s
Precision: 64
Internal Precision: 1408
\[\frac{e^{x} - 1}{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.022260873555785567:\\ \;\;\;\;\frac{\frac{e^{x + x} - 1}{e^{x} + 1}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(e^{x}\right)}^{\left(x \cdot \frac{1}{24} + \frac{1}{2}\right)}}{{\left(e^{\frac{1}{2880}}\right)}^{\left({x}^{4}\right)}}\\ \end{array}\]

Error

Bits error versus x

Target

Original40.0
Target39.2
Herbie0.2
\[\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.022260873555785567

    1. Initial program 0.0

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

      \[\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}\]

    if -0.022260873555785567 < x

    1. Initial program 60.0

      \[\frac{e^{x} - 1}{x}\]
    2. Using strategy rm
    3. Applied add-exp-log60.0

      \[\leadsto \color{blue}{e^{\log \left(\frac{e^{x} - 1}{x}\right)}}\]
    4. Taylor expanded around 0 0.3

      \[\leadsto e^{\color{blue}{\left(\frac{1}{24} \cdot {x}^{2} + \frac{1}{2} \cdot x\right) - \frac{1}{2880} \cdot {x}^{4}}}\]
    5. Applied simplify0.3

      \[\leadsto \color{blue}{\frac{{\left(e^{x}\right)}^{\left(x \cdot \frac{1}{24} + \frac{1}{2}\right)}}{{\left(e^{\frac{1}{2880}}\right)}^{\left({x}^{4}\right)}}}\]
  3. Recombined 2 regimes into one program.
  4. Removed slow pow expressions.

Runtime

Time bar (total: 39.8s)Debug logProfile

herbie shell --seed '#(1063313015 2771194459 1594909340 1344785158 2223560818 546365448)' 
(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))