Average Error: 14.3 → 0.4
Time: 1.3m
Precision: 64
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[\frac{1}{x \cdot x - 1} \cdot -2\]
\frac{1}{x + 1} - \frac{1}{x - 1}
\frac{1}{x \cdot x - 1} \cdot -2
double f(double x) {
        double r4415466 = 1.0;
        double r4415467 = x;
        double r4415468 = r4415467 + r4415466;
        double r4415469 = r4415466 / r4415468;
        double r4415470 = r4415467 - r4415466;
        double r4415471 = r4415466 / r4415470;
        double r4415472 = r4415469 - r4415471;
        return r4415472;
}

double f(double x) {
        double r4415473 = 1.0;
        double r4415474 = x;
        double r4415475 = r4415474 * r4415474;
        double r4415476 = r4415475 - r4415473;
        double r4415477 = r4415473 / r4415476;
        double r4415478 = -2.0;
        double r4415479 = r4415477 * r4415478;
        return r4415479;
}

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

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

    \[\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}{-2}\]
  9. Final simplification0.4

    \[\leadsto \frac{1}{x \cdot x - 1} \cdot -2\]

Reproduce

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