Average Error: 14.3 → 0.1
Time: 10.2s
Precision: 64
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[\frac{-1}{x + 1} \cdot \left(\frac{1}{x - 1} \cdot 2\right)\]
\frac{1}{x + 1} - \frac{1}{x - 1}
\frac{-1}{x + 1} \cdot \left(\frac{1}{x - 1} \cdot 2\right)
double f(double x) {
        double r101597 = 1.0;
        double r101598 = x;
        double r101599 = r101598 + r101597;
        double r101600 = r101597 / r101599;
        double r101601 = r101598 - r101597;
        double r101602 = r101597 / r101601;
        double r101603 = r101600 - r101602;
        return r101603;
}

double f(double x) {
        double r101604 = -1.0;
        double r101605 = x;
        double r101606 = 1.0;
        double r101607 = r101605 + r101606;
        double r101608 = r101604 / r101607;
        double r101609 = r101605 - r101606;
        double r101610 = r101606 / r101609;
        double r101611 = 2.0;
        double r101612 = r101610 * r101611;
        double r101613 = r101608 * r101612;
        return r101613;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 14.3

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

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

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

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

    \[\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 \frac{-1}{x + 1} \cdot \left(\frac{1}{x - 1} \cdot 2\right)\]

Reproduce

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