Average Error: 39.8 → 0.1
Time: 8.6s
Precision: 64
Internal Precision: 128
\[\frac{e^{x} - 1}{x}\]
\[\frac{1}{x} \cdot (e^{x} - 1)^*\]

Error

Bits error versus x

Target

Original39.8
Target39.0
Herbie0.1
\[\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. Initial program 39.8

    \[\frac{e^{x} - 1}{x}\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\frac{(e^{x} - 1)^*}{x}}\]
  3. Using strategy rm
  4. Applied div-inv0.1

    \[\leadsto \color{blue}{(e^{x} - 1)^* \cdot \frac{1}{x}}\]
  5. Final simplification0.1

    \[\leadsto \frac{1}{x} \cdot (e^{x} - 1)^*\]

Reproduce

herbie shell --seed 2019089 +o rules:numerics
(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))