Average Error: 40.0 → 0.0
Time: 3.2s
Precision: 64
\[\frac{e^{x} - 1}{x}\]
\[\frac{(e^{x} - 1)^*}{x}\]
\frac{e^{x} - 1}{x}
\frac{(e^{x} - 1)^*}{x}
double f(double x) {
        double r3509082 = x;
        double r3509083 = exp(r3509082);
        double r3509084 = 1.0;
        double r3509085 = r3509083 - r3509084;
        double r3509086 = r3509085 / r3509082;
        return r3509086;
}

double f(double x) {
        double r3509087 = x;
        double r3509088 = expm1(r3509087);
        double r3509089 = r3509088 / r3509087;
        return r3509089;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original40.0
Target39.2
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.0

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

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

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

Reproduce

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