Average Error: 14.3 → 0.1
Time: 9.6s
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 r114615 = 1.0;
        double r114616 = x;
        double r114617 = r114616 + r114615;
        double r114618 = r114615 / r114617;
        double r114619 = r114616 - r114615;
        double r114620 = r114615 / r114619;
        double r114621 = r114618 - r114620;
        return r114621;
}

double f(double x) {
        double r114622 = 1.0;
        double r114623 = x;
        double r114624 = r114623 - r114622;
        double r114625 = r114622 / r114624;
        double r114626 = 2.0;
        double r114627 = -r114626;
        double r114628 = r114625 * r114627;
        double r114629 = r114623 + r114622;
        double r114630 = r114628 / r114629;
        return r114630;
}

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--28.8

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

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

    \[\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. 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 add-sqr-sqrt0.4

    \[\leadsto \frac{\color{blue}{\sqrt{1} \cdot \sqrt{1}}}{\left(x + 1\right) \cdot \left(x - 1\right)} \cdot \left(-2\right)\]
  12. Applied times-frac0.1

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

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

    \[\leadsto \color{blue}{\frac{\sqrt{1} \cdot \left(\frac{\sqrt{1}}{x - 1} \cdot \left(-2\right)\right)}{x + 1}}\]
  16. Simplified0.1

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

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

Reproduce

herbie shell --seed 2019235 
(FPCore (x)
  :name "Asymptote A"
  :precision binary64
  (- (/ 1 (+ x 1)) (/ 1 (- x 1))))