Average Error: 14.7 → 0.1
Time: 27.4s
Precision: 64
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[-\frac{\frac{1}{x + 1}}{x - 1} \cdot 2\]
\frac{1}{x + 1} - \frac{1}{x - 1}
-\frac{\frac{1}{x + 1}}{x - 1} \cdot 2
double f(double x) {
        double r5740008 = 1.0;
        double r5740009 = x;
        double r5740010 = r5740009 + r5740008;
        double r5740011 = r5740008 / r5740010;
        double r5740012 = r5740009 - r5740008;
        double r5740013 = r5740008 / r5740012;
        double r5740014 = r5740011 - r5740013;
        return r5740014;
}

double f(double x) {
        double r5740015 = 1.0;
        double r5740016 = x;
        double r5740017 = r5740016 + r5740015;
        double r5740018 = r5740015 / r5740017;
        double r5740019 = r5740016 - r5740015;
        double r5740020 = r5740018 / r5740019;
        double r5740021 = 2.0;
        double r5740022 = r5740020 * r5740021;
        double r5740023 = -r5740022;
        return r5740023;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 14.7

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

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

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

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

    \[\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--14.1

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

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

Reproduce

herbie shell --seed 2019168 
(FPCore (x)
  :name "Asymptote A"
  (- (/ 1.0 (+ x 1.0)) (/ 1.0 (- x 1.0))))