Average Error: 14.7 → 0.1
Time: 15.0s
Precision: 64
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[\frac{\frac{1}{x + 1}}{x - 1} \cdot -2\]
\frac{1}{x + 1} - \frac{1}{x - 1}
\frac{\frac{1}{x + 1}}{x - 1} \cdot -2
double f(double x) {
        double r5150037 = 1.0;
        double r5150038 = x;
        double r5150039 = r5150038 + r5150037;
        double r5150040 = r5150037 / r5150039;
        double r5150041 = r5150038 - r5150037;
        double r5150042 = r5150037 / r5150041;
        double r5150043 = r5150040 - r5150042;
        return r5150043;
}

double f(double x) {
        double r5150044 = 1.0;
        double r5150045 = x;
        double r5150046 = r5150045 + r5150044;
        double r5150047 = r5150044 / r5150046;
        double r5150048 = r5150045 - r5150044;
        double r5150049 = r5150047 / r5150048;
        double r5150050 = -2.0;
        double r5150051 = r5150049 * r5150050;
        return r5150051;
}

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

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

    \[\leadsto \frac{1}{\color{blue}{\left(x + 1\right) \cdot \left(x - 1\right)}} \cdot -2\]
  11. Applied associate-/r*0.1

    \[\leadsto \color{blue}{\frac{\frac{1}{x + 1}}{x - 1}} \cdot -2\]
  12. Final simplification0.1

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

Reproduce

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