Average Error: 14.5 → 0.1
Time: 13.4s
Precision: 64
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[\frac{\frac{1}{x + 1} \cdot \left(-2\right)}{x - 1}\]
\frac{1}{x + 1} - \frac{1}{x - 1}
\frac{\frac{1}{x + 1} \cdot \left(-2\right)}{x - 1}
double f(double x) {
        double r79604 = 1.0;
        double r79605 = x;
        double r79606 = r79605 + r79604;
        double r79607 = r79604 / r79606;
        double r79608 = r79605 - r79604;
        double r79609 = r79604 / r79608;
        double r79610 = r79607 - r79609;
        return r79610;
}

double f(double x) {
        double r79611 = 1.0;
        double r79612 = x;
        double r79613 = r79612 + r79611;
        double r79614 = r79611 / r79613;
        double r79615 = 2.0;
        double r79616 = -r79615;
        double r79617 = r79614 * r79616;
        double r79618 = r79612 - r79611;
        double r79619 = r79617 / r79618;
        return r79619;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 14.5

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

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

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

    \[\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.5

    \[\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.9

    \[\leadsto \color{blue}{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(\left(x - 1\right) - \left(x + 1\right)\right)}\]
  8. Taylor expanded around 0 0.4

    \[\leadsto \frac{1}{x \cdot x - 1 \cdot 1} \cdot \color{blue}{\left(-2\right)}\]
  9. Using strategy rm
  10. Applied difference-of-squares0.4

    \[\leadsto \frac{1}{\color{blue}{\left(x + 1\right) \cdot \left(x - 1\right)}} \cdot \left(-2\right)\]
  11. Applied associate-/r*0.1

    \[\leadsto \color{blue}{\frac{\frac{1}{x + 1}}{x - 1}} \cdot \left(-2\right)\]
  12. Using strategy rm
  13. Applied associate-*l/0.1

    \[\leadsto \color{blue}{\frac{\frac{1}{x + 1} \cdot \left(-2\right)}{x - 1}}\]
  14. Final simplification0.1

    \[\leadsto \frac{\frac{1}{x + 1} \cdot \left(-2\right)}{x - 1}\]

Reproduce

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