Average Error: 14.3 → 0.1
Time: 13.5s
Precision: 64
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[1 \cdot \frac{\frac{1 \cdot -2}{x + 1}}{x - 1}\]
\frac{1}{x + 1} - \frac{1}{x - 1}
1 \cdot \frac{\frac{1 \cdot -2}{x + 1}}{x - 1}
double f(double x) {
        double r93553 = 1.0;
        double r93554 = x;
        double r93555 = r93554 + r93553;
        double r93556 = r93553 / r93555;
        double r93557 = r93554 - r93553;
        double r93558 = r93553 / r93557;
        double r93559 = r93556 - r93558;
        return r93559;
}

double f(double x) {
        double r93560 = 1.0;
        double r93561 = -2.0;
        double r93562 = r93560 * r93561;
        double r93563 = x;
        double r93564 = r93563 + r93560;
        double r93565 = r93562 / r93564;
        double r93566 = r93563 - r93560;
        double r93567 = r93565 / r93566;
        double r93568 = r93560 * r93567;
        return r93568;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 14.3

    \[\frac{1}{x + 1} - \frac{1}{x - 1}\]
  2. Using strategy rm
  3. Applied flip--29.0

    \[\leadsto \frac{1}{x + 1} - \frac{1}{\color{blue}{\frac{x \cdot x - 1 \cdot 1}{x + 1}}}\]
  4. Applied associate-/r/29.0

    \[\leadsto \frac{1}{x + 1} - \color{blue}{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right)}\]
  5. Applied flip-+14.3

    \[\leadsto \frac{1}{\color{blue}{\frac{x \cdot x - 1 \cdot 1}{x - 1}}} - \frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right)\]
  6. Applied associate-/r/14.3

    \[\leadsto \color{blue}{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x - 1\right)} - \frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right)\]
  7. Applied distribute-lft-out--13.7

    \[\leadsto \color{blue}{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(\left(x - 1\right) - \left(x + 1\right)\right)}\]
  8. Using strategy rm
  9. Applied associate--r+11.8

    \[\leadsto \frac{1}{x \cdot x - 1 \cdot 1} \cdot \color{blue}{\left(\left(\left(x - 1\right) - x\right) - 1\right)}\]
  10. Simplified0.3

    \[\leadsto \frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(\color{blue}{\left(0 - 1\right)} - 1\right)\]
  11. Using strategy rm
  12. Applied div-inv0.3

    \[\leadsto \color{blue}{\left(1 \cdot \frac{1}{x \cdot x - 1 \cdot 1}\right)} \cdot \left(\left(0 - 1\right) - 1\right)\]
  13. Applied associate-*l*0.3

    \[\leadsto \color{blue}{1 \cdot \left(\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(\left(0 - 1\right) - 1\right)\right)}\]
  14. Simplified0.1

    \[\leadsto 1 \cdot \color{blue}{\frac{\frac{1 \cdot -2}{x + 1}}{x - 1}}\]
  15. Final simplification0.1

    \[\leadsto 1 \cdot \frac{\frac{1 \cdot -2}{x + 1}}{x - 1}\]

Reproduce

herbie shell --seed 2019303 +o rules:numerics
(FPCore (x)
  :name "Asymptote A"
  :precision binary64
  (- (/ 1 (+ x 1)) (/ 1 (- x 1))))