Average Error: 15.0 → 0.1
Time: 2.8s
Precision: 64
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[1 \cdot \frac{\frac{-2}{x + 1}}{x - 1}\]
\frac{1}{x + 1} - \frac{1}{x - 1}
1 \cdot \frac{\frac{-2}{x + 1}}{x - 1}
double f(double x) {
        double r99369 = 1.0;
        double r99370 = x;
        double r99371 = r99370 + r99369;
        double r99372 = r99369 / r99371;
        double r99373 = r99370 - r99369;
        double r99374 = r99369 / r99373;
        double r99375 = r99372 - r99374;
        return r99375;
}

double f(double x) {
        double r99376 = 1.0;
        double r99377 = 2.0;
        double r99378 = -r99377;
        double r99379 = x;
        double r99380 = r99379 + r99376;
        double r99381 = r99378 / r99380;
        double r99382 = r99379 - r99376;
        double r99383 = r99381 / r99382;
        double r99384 = r99376 * r99383;
        return r99384;
}

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

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

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

    \[\leadsto \frac{1}{x \cdot x - 1 \cdot 1} \cdot \color{blue}{\left(-2\right)}\]
  9. Using strategy rm
  10. Applied div-inv0.5

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

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

    \[\leadsto 1 \cdot \color{blue}{\frac{\frac{-2}{x + 1}}{x - 1}}\]
  13. Final simplification0.1

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

Reproduce

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