Average Error: 14.2 → 0.1
Time: 3.6s
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 r124000 = 1.0;
        double r124001 = x;
        double r124002 = r124001 + r124000;
        double r124003 = r124000 / r124002;
        double r124004 = r124001 - r124000;
        double r124005 = r124000 / r124004;
        double r124006 = r124003 - r124005;
        return r124006;
}

double f(double x) {
        double r124007 = 1.0;
        double r124008 = 2.0;
        double r124009 = -r124008;
        double r124010 = x;
        double r124011 = r124010 + r124007;
        double r124012 = r124009 / r124011;
        double r124013 = r124010 - r124007;
        double r124014 = r124012 / r124013;
        double r124015 = r124007 * r124014;
        return r124015;
}

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

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

    \[\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.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 div-inv0.4

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

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