Average Error: 14.8 → 0.1
Time: 11.6s
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 r8040222 = 1.0;
        double r8040223 = x;
        double r8040224 = r8040223 + r8040222;
        double r8040225 = r8040222 / r8040224;
        double r8040226 = r8040223 - r8040222;
        double r8040227 = r8040222 / r8040226;
        double r8040228 = r8040225 - r8040227;
        return r8040228;
}

double f(double x) {
        double r8040229 = 1.0;
        double r8040230 = x;
        double r8040231 = r8040230 + r8040229;
        double r8040232 = r8040229 / r8040231;
        double r8040233 = 2.0;
        double r8040234 = -r8040233;
        double r8040235 = r8040232 * r8040234;
        double r8040236 = r8040230 - r8040229;
        double r8040237 = r8040235 / r8040236;
        return r8040237;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 14.8

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

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

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

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

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

    \[\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 2019174 
(FPCore (x)
  :name "Asymptote A"
  (- (/ 1.0 (+ x 1.0)) (/ 1.0 (- x 1.0))))