Average Error: 14.7 → 0.1
Time: 11.8s
Precision: 64
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[\left(2 \cdot \frac{1}{x - 1}\right) \cdot \frac{-1}{x + 1}\]
\frac{1}{x + 1} - \frac{1}{x - 1}
\left(2 \cdot \frac{1}{x - 1}\right) \cdot \frac{-1}{x + 1}
double f(double x) {
        double r5637288 = 1.0;
        double r5637289 = x;
        double r5637290 = r5637289 + r5637288;
        double r5637291 = r5637288 / r5637290;
        double r5637292 = r5637289 - r5637288;
        double r5637293 = r5637288 / r5637292;
        double r5637294 = r5637291 - r5637293;
        return r5637294;
}

double f(double x) {
        double r5637295 = 2.0;
        double r5637296 = 1.0;
        double r5637297 = x;
        double r5637298 = r5637297 - r5637296;
        double r5637299 = r5637296 / r5637298;
        double r5637300 = r5637295 * r5637299;
        double r5637301 = -1.0;
        double r5637302 = r5637297 + r5637296;
        double r5637303 = r5637301 / r5637302;
        double r5637304 = r5637300 * r5637303;
        return r5637304;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 14.7

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

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

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

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

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

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

    \[\leadsto \frac{1}{x \cdot x - 1 \cdot 1} \cdot \color{blue}{\left(-2\right)}\]
  9. Using strategy rm
  10. Applied difference-of-squares0.3

    \[\leadsto \frac{1}{\color{blue}{\left(x + 1\right) \cdot \left(x - 1\right)}} \cdot \left(-2\right)\]
  11. Applied *-un-lft-identity0.3

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

Reproduce

herbie shell --seed 2019172 
(FPCore (x)
  :name "Asymptote A"
  (- (/ 1.0 (+ x 1.0)) (/ 1.0 (- x 1.0))))