Average Error: 40.3 → 0.4
Time: 9.6s
Precision: 64
\[\frac{e^{x}}{e^{x} - 1}\]
\[\frac{e^{x}}{(e^{x} - 1)^*}\]
\frac{e^{x}}{e^{x} - 1}
\frac{e^{x}}{(e^{x} - 1)^*}
double f(double x) {
        double r4276407 = x;
        double r4276408 = exp(r4276407);
        double r4276409 = 1.0;
        double r4276410 = r4276408 - r4276409;
        double r4276411 = r4276408 / r4276410;
        return r4276411;
}

double f(double x) {
        double r4276412 = x;
        double r4276413 = exp(r4276412);
        double r4276414 = expm1(r4276412);
        double r4276415 = r4276413 / r4276414;
        return r4276415;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original40.3
Target39.9
Herbie0.4
\[\frac{1}{1 - e^{-x}}\]

Derivation

  1. Initial program 40.3

    \[\frac{e^{x}}{e^{x} - 1}\]
  2. Using strategy rm
  3. Applied expm1-def0.4

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

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

Reproduce

herbie shell --seed 2019119 +o rules:numerics
(FPCore (x)
  :name "expq2 (section 3.11)"

  :herbie-target
  (/ 1 (- 1 (exp (- x))))

  (/ (exp x) (- (exp x) 1)))