Average Error: 14.2 → 0.1
Time: 12.4s
Precision: 64
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[\left(2 \cdot \frac{1}{x - 1}\right) \cdot \frac{-1}{x + 1}\]
\frac{1}{x + 1} - \frac{1}{x - 1}
\left(2 \cdot \frac{1}{x - 1}\right) \cdot \frac{-1}{x + 1}
double f(double x) {
        double r5016327 = 1.0;
        double r5016328 = x;
        double r5016329 = r5016328 + r5016327;
        double r5016330 = r5016327 / r5016329;
        double r5016331 = r5016328 - r5016327;
        double r5016332 = r5016327 / r5016331;
        double r5016333 = r5016330 - r5016332;
        return r5016333;
}

double f(double x) {
        double r5016334 = 2.0;
        double r5016335 = 1.0;
        double r5016336 = x;
        double r5016337 = r5016336 - r5016335;
        double r5016338 = r5016335 / r5016337;
        double r5016339 = r5016334 * r5016338;
        double r5016340 = -1.0;
        double r5016341 = r5016336 + r5016335;
        double r5016342 = r5016340 / r5016341;
        double r5016343 = r5016339 * r5016342;
        return r5016343;
}

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.4

    \[\leadsto \frac{1}{x + 1} - \frac{1}{\color{blue}{\frac{x \cdot x - 1 \cdot 1}{x + 1}}}\]
  4. Applied associate-/r/28.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.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 *-un-lft-identity0.4

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

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

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

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

Reproduce

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