Average Error: 14.4 → 0.1
Time: 8.9s
Precision: 64
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[\frac{\frac{-2}{1 + x}}{x - 1}\]
\frac{1}{x + 1} - \frac{1}{x - 1}
\frac{\frac{-2}{1 + x}}{x - 1}
double f(double x) {
        double r2371837 = 1.0;
        double r2371838 = x;
        double r2371839 = r2371838 + r2371837;
        double r2371840 = r2371837 / r2371839;
        double r2371841 = r2371838 - r2371837;
        double r2371842 = r2371837 / r2371841;
        double r2371843 = r2371840 - r2371842;
        return r2371843;
}

double f(double x) {
        double r2371844 = -2.0;
        double r2371845 = 1.0;
        double r2371846 = x;
        double r2371847 = r2371845 + r2371846;
        double r2371848 = r2371844 / r2371847;
        double r2371849 = r2371846 - r2371845;
        double r2371850 = r2371848 / r2371849;
        return r2371850;
}

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--28.9

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

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

    \[\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. Using strategy rm
  13. Applied associate-*l/0.1

    \[\leadsto \color{blue}{\frac{\frac{1}{x + 1} \cdot -2}{x - 1}}\]
  14. Simplified0.1

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

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

Reproduce

herbie shell --seed 2019154 
(FPCore (x)
  :name "Asymptote A"
  (- (/ 1 (+ x 1)) (/ 1 (- x 1))))