Average Error: 40.2 → 0.0
Time: 39.9s
Precision: 64
\[\frac{e^{x} - 1}{x}\]
\[\frac{1}{\frac{x}{(e^{x} - 1)^*}}\]

Error

Bits error versus x

Target

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

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

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

    \[\leadsto \frac{\color{blue}{1 \cdot (e^{x} - 1)^*}}{x}\]
  5. Applied associate-/l*0.0

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

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

Reproduce

herbie shell --seed 2019100 +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))