Average Error: 14.4 → 0.1
Time: 2.7s
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 r126276 = 1.0;
        double r126277 = x;
        double r126278 = r126277 + r126276;
        double r126279 = r126276 / r126278;
        double r126280 = r126277 - r126276;
        double r126281 = r126276 / r126280;
        double r126282 = r126279 - r126281;
        return r126282;
}

double f(double x) {
        double r126283 = 1.0;
        double r126284 = 2.0;
        double r126285 = -r126284;
        double r126286 = x;
        double r126287 = r126286 + r126283;
        double r126288 = r126285 / r126287;
        double r126289 = r126286 - r126283;
        double r126290 = r126288 / r126289;
        double r126291 = r126283 * r126290;
        return r126291;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 14.4

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

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

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

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

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

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

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