Average Error: 14.3 → 0.4
Time: 13.1s
Precision: 64
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(-2\right)\]
\frac{1}{x + 1} - \frac{1}{x - 1}
\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(-2\right)
double f(double x) {
        double r128418 = 1.0;
        double r128419 = x;
        double r128420 = r128419 + r128418;
        double r128421 = r128418 / r128420;
        double r128422 = r128419 - r128418;
        double r128423 = r128418 / r128422;
        double r128424 = r128421 - r128423;
        return r128424;
}

double f(double x) {
        double r128425 = 1.0;
        double r128426 = x;
        double r128427 = r128426 * r128426;
        double r128428 = r128425 * r128425;
        double r128429 = r128427 - r128428;
        double r128430 = r128425 / r128429;
        double r128431 = 2.0;
        double r128432 = -r128431;
        double r128433 = r128430 * r128432;
        return r128433;
}

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

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

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

    \[\leadsto \frac{1}{x \cdot x - 1 \cdot 1} \cdot \color{blue}{\left(-2\right)}\]
  9. Final simplification0.4

    \[\leadsto \frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(-2\right)\]

Reproduce

herbie shell --seed 2019195 +o rules:numerics
(FPCore (x)
  :name "Asymptote A"
  (- (/ 1.0 (+ x 1.0)) (/ 1.0 (- x 1.0))))