Average Error: 14.5 → 0.1
Time: 12.2s
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 r5375028 = 1.0;
        double r5375029 = x;
        double r5375030 = r5375029 + r5375028;
        double r5375031 = r5375028 / r5375030;
        double r5375032 = r5375029 - r5375028;
        double r5375033 = r5375028 / r5375032;
        double r5375034 = r5375031 - r5375033;
        return r5375034;
}

double f(double x) {
        double r5375035 = -2.0;
        double r5375036 = 1.0;
        double r5375037 = x;
        double r5375038 = r5375036 + r5375037;
        double r5375039 = r5375035 / r5375038;
        double r5375040 = r5375037 - r5375036;
        double r5375041 = r5375039 / r5375040;
        return r5375041;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 14.5

    \[\frac{1}{x + 1} - \frac{1}{x - 1}\]
  2. Using strategy rm
  3. Applied flip--28.4

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

    \[\leadsto \frac{1}{x + 1} - \color{blue}{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right)}\]
  5. Applied flip-+14.5

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

    \[\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 2019158 
(FPCore (x)
  :name "Asymptote A"
  (- (/ 1 (+ x 1)) (/ 1 (- x 1))))