\[\frac{e^{x} - 1}{x}\]
Test:
Kahan's exp quotient
Bits:
128 bits
Bits error versus x
Time: 36.7 s
Input Error: 18.8
Output Error: 1.4
Log:
Profile: 🕒
\(\begin{cases} \frac{e^{x}}{x} - \frac{1}{x} & \text{when } x \le -0.012142818f0 \\ \frac{\left(x \cdot \frac{1}{6} + \frac{1}{2}\right) \cdot {x}^2 + x}{x} & \text{otherwise} \end{cases}\)

    if x < -0.012142818f0

    1. Started with
      \[\frac{e^{x} - 1}{x}\]
      0.1
    2. Using strategy rm
      0.1
    3. Applied div-sub to get
      \[\color{red}{\frac{e^{x} - 1}{x}} \leadsto \color{blue}{\frac{e^{x}}{x} - \frac{1}{x}}\]
      0.1

    if -0.012142818f0 < x

    1. Started with
      \[\frac{e^{x} - 1}{x}\]
      27.2
    2. Using strategy rm
      27.2
    3. Applied add-cube-cbrt to get
      \[\color{red}{\frac{e^{x} - 1}{x}} \leadsto \color{blue}{{\left(\sqrt[3]{\frac{e^{x} - 1}{x}}\right)}^3}\]
      27.2
    4. Applied taylor to get
      \[{\left(\sqrt[3]{\frac{e^{x} - 1}{x}}\right)}^3 \leadsto {\left(\sqrt[3]{\frac{\frac{1}{2} \cdot {x}^2 + \left(\frac{1}{6} \cdot {x}^{3} + x\right)}{x}}\right)}^3\]
      2.1
    5. Taylor expanded around 0 to get
      \[{\left(\sqrt[3]{\frac{\color{red}{\frac{1}{2} \cdot {x}^2 + \left(\frac{1}{6} \cdot {x}^{3} + x\right)}}{x}}\right)}^3 \leadsto {\left(\sqrt[3]{\frac{\color{blue}{\frac{1}{2} \cdot {x}^2 + \left(\frac{1}{6} \cdot {x}^{3} + x\right)}}{x}}\right)}^3\]
      2.1
    6. Applied simplify to get
      \[{\left(\sqrt[3]{\frac{\frac{1}{2} \cdot {x}^2 + \left(\frac{1}{6} \cdot {x}^{3} + x\right)}{x}}\right)}^3 \leadsto \frac{\left(\left(x \cdot x\right) \cdot \frac{1}{2} + x\right) + \frac{1}{6} \cdot {x}^3}{x}\]
      2.0

    7. Applied final simplification
    8. Applied simplify to get
      \[\color{red}{\frac{\left(\left(x \cdot x\right) \cdot \frac{1}{2} + x\right) + \frac{1}{6} \cdot {x}^3}{x}} \leadsto \color{blue}{\frac{\left(x \cdot \frac{1}{6} + \frac{1}{2}\right) \cdot {x}^2 + x}{x}}\]
      2.0

  1. Removed slow pow expressions

Original test:


(lambda ((x default))
  #:name "Kahan's exp quotient"
  (/ (- (exp x) 1) x)
  #:target
  (if (and (< x 1) (> x -1)) (/ (- (exp x) 1) (log (exp x))) (/ (- (exp x) 1) x)))