\[\frac{e^{x} - 1}{x}\]
Test:
Kahan's exp quotient
Bits:
128 bits
Bits error versus x
Time: 6.4 s
Input Error: 17.7
Output Error: 0.1
Log:
Profile: 🕒
\(\begin{cases} \frac{e^{x} - 1}{x} & \text{when } x \le -0.03550508f0 \\ \frac{x \cdot \left(\left(x \cdot \frac{1}{8} + \frac{1}{2}\right) + {x}^2 \cdot \frac{1}{48}\right)}{\frac{x}{1 + \sqrt{e^{x}}}} & \text{otherwise} \end{cases}\)

    if x < -0.03550508f0

    1. Started with
      \[\frac{e^{x} - 1}{x}\]
      0.1

    if -0.03550508f0 < x

    1. Started with
      \[\frac{e^{x} - 1}{x}\]
      26.6
    2. Using strategy rm
      26.6
    3. Applied add-sqr-sqrt to get
      \[\frac{\color{red}{e^{x}} - 1}{x} \leadsto \frac{\color{blue}{{\left(\sqrt{e^{x}}\right)}^2} - 1}{x}\]
      26.8
    4. Applied difference-of-sqr-1 to get
      \[\frac{\color{red}{{\left(\sqrt{e^{x}}\right)}^2 - 1}}{x} \leadsto \frac{\color{blue}{\left(\sqrt{e^{x}} + 1\right) \cdot \left(\sqrt{e^{x}} - 1\right)}}{x}\]
      26.8
    5. Applied taylor to get
      \[\frac{\left(\sqrt{e^{x}} + 1\right) \cdot \left(\sqrt{e^{x}} - 1\right)}{x} \leadsto \frac{\left(\sqrt{e^{x}} + 1\right) \cdot \left(\frac{1}{8} \cdot {x}^2 + \left(\frac{1}{48} \cdot {x}^{3} + \frac{1}{2} \cdot x\right)\right)}{x}\]
      0.1
    6. Taylor expanded around 0 to get
      \[\frac{\left(\sqrt{e^{x}} + 1\right) \cdot \color{red}{\left(\frac{1}{8} \cdot {x}^2 + \left(\frac{1}{48} \cdot {x}^{3} + \frac{1}{2} \cdot x\right)\right)}}{x} \leadsto \frac{\left(\sqrt{e^{x}} + 1\right) \cdot \color{blue}{\left(\frac{1}{8} \cdot {x}^2 + \left(\frac{1}{48} \cdot {x}^{3} + \frac{1}{2} \cdot x\right)\right)}}{x}\]
      0.1
    7. Applied simplify to get
      \[\frac{\left(\sqrt{e^{x}} + 1\right) \cdot \left(\frac{1}{8} \cdot {x}^2 + \left(\frac{1}{48} \cdot {x}^{3} + \frac{1}{2} \cdot x\right)\right)}{x} \leadsto \frac{\left({x}^3 \cdot \frac{1}{48} + {x}^2 \cdot \frac{1}{8}\right) + x \cdot \frac{1}{2}}{\frac{x}{\sqrt{e^{x}} + 1}}\]
      0.2

    8. Applied final simplification
    9. Applied simplify to get
      \[\color{red}{\frac{\left({x}^3 \cdot \frac{1}{48} + {x}^2 \cdot \frac{1}{8}\right) + x \cdot \frac{1}{2}}{\frac{x}{\sqrt{e^{x}} + 1}}} \leadsto \color{blue}{\frac{x \cdot \left(\left(x \cdot \frac{1}{8} + \frac{1}{2}\right) + {x}^2 \cdot \frac{1}{48}\right)}{\frac{x}{1 + \sqrt{e^{x}}}}}\]
      0.2

  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)))