Average Error: 14.2 → 0.1
Time: 5.1s
Precision: 64
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[\frac{\sqrt{1}}{x + 1} \cdot \left(\frac{\sqrt{1}}{x - 1} \cdot \left(-2\right)\right)\]
\frac{1}{x + 1} - \frac{1}{x - 1}
\frac{\sqrt{1}}{x + 1} \cdot \left(\frac{\sqrt{1}}{x - 1} \cdot \left(-2\right)\right)
double f(double x) {
        double r117712 = 1.0;
        double r117713 = x;
        double r117714 = r117713 + r117712;
        double r117715 = r117712 / r117714;
        double r117716 = r117713 - r117712;
        double r117717 = r117712 / r117716;
        double r117718 = r117715 - r117717;
        return r117718;
}

double f(double x) {
        double r117719 = 1.0;
        double r117720 = sqrt(r117719);
        double r117721 = x;
        double r117722 = r117721 + r117719;
        double r117723 = r117720 / r117722;
        double r117724 = r117721 - r117719;
        double r117725 = r117720 / r117724;
        double r117726 = 2.0;
        double r117727 = -r117726;
        double r117728 = r117725 * r117727;
        double r117729 = r117723 * r117728;
        return r117729;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 14.2

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

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

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

    \[\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. Final simplification0.1

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

Reproduce

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