Average Error: 40.3 → 0.4
Time: 20.9s
Precision: 64
\[\frac{e^{x}}{e^{x} - 1}\]
\[\frac{1}{\frac{\mathsf{expm1}\left(x\right)}{e^{x}}}\]
\frac{e^{x}}{e^{x} - 1}
\frac{1}{\frac{\mathsf{expm1}\left(x\right)}{e^{x}}}
double f(double x) {
        double r7509260 = x;
        double r7509261 = exp(r7509260);
        double r7509262 = 1.0;
        double r7509263 = r7509261 - r7509262;
        double r7509264 = r7509261 / r7509263;
        return r7509264;
}

double f(double x) {
        double r7509265 = 1.0;
        double r7509266 = x;
        double r7509267 = expm1(r7509266);
        double r7509268 = exp(r7509266);
        double r7509269 = r7509267 / r7509268;
        double r7509270 = r7509265 / r7509269;
        return r7509270;
}

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}{\mathsf{expm1}\left(x\right)}}\]
  4. Using strategy rm
  5. Applied *-un-lft-identity0.4

    \[\leadsto \frac{\color{blue}{1 \cdot e^{x}}}{\mathsf{expm1}\left(x\right)}\]
  6. Applied associate-/l*0.4

    \[\leadsto \color{blue}{\frac{1}{\frac{\mathsf{expm1}\left(x\right)}{e^{x}}}}\]
  7. Final simplification0.4

    \[\leadsto \frac{1}{\frac{\mathsf{expm1}\left(x\right)}{e^{x}}}\]

Reproduce

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

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

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