Average Error: 14.8 → 0.1
Time: 11.3s
Precision: 64
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[\frac{2 \cdot \frac{-1}{x + 1}}{x - 1}\]
\frac{1}{x + 1} - \frac{1}{x - 1}
\frac{2 \cdot \frac{-1}{x + 1}}{x - 1}
double f(double x) {
        double r6444739 = 1.0;
        double r6444740 = x;
        double r6444741 = r6444740 + r6444739;
        double r6444742 = r6444739 / r6444741;
        double r6444743 = r6444740 - r6444739;
        double r6444744 = r6444739 / r6444743;
        double r6444745 = r6444742 - r6444744;
        return r6444745;
}

double f(double x) {
        double r6444746 = 2.0;
        double r6444747 = 1.0;
        double r6444748 = -r6444747;
        double r6444749 = x;
        double r6444750 = r6444749 + r6444747;
        double r6444751 = r6444748 / r6444750;
        double r6444752 = r6444746 * r6444751;
        double r6444753 = r6444749 - r6444747;
        double r6444754 = r6444752 / r6444753;
        return r6444754;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 14.8

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

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

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

    \[\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. Using strategy rm
  10. Applied difference-of-squares0.5

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

    \[\leadsto \color{blue}{\frac{\frac{1}{x + 1}}{x - 1}} \cdot \left(-2\right)\]
  12. Using strategy rm
  13. Applied associate-*l/0.1

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

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

Reproduce

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