Average Error: 15.0 → 0.1
Time: 6.0s
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 r221339 = 1.0;
        double r221340 = x;
        double r221341 = r221340 + r221339;
        double r221342 = r221339 / r221341;
        double r221343 = r221340 - r221339;
        double r221344 = r221339 / r221343;
        double r221345 = r221342 - r221344;
        return r221345;
}

double f(double x) {
        double r221346 = 1.0;
        double r221347 = x;
        double r221348 = r221347 + r221346;
        double r221349 = r221346 / r221348;
        double r221350 = 2.0;
        double r221351 = -r221350;
        double r221352 = r221349 * r221351;
        double r221353 = r221347 - r221346;
        double r221354 = r221352 / r221353;
        return r221354;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 15.0

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

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

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

    \[\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/15.0

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

    \[\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 2020045 
(FPCore (x)
  :name "Asymptote A"
  :precision binary64
  (- (/ 1 (+ x 1)) (/ 1 (- x 1))))