Average Error: 0.0 → 0.0
Time: 1.6s
Precision: 64
\[\frac{1}{x - 1} + \frac{x}{x + 1}\]
\[\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right) + \frac{x}{x + 1}\]
\frac{1}{x - 1} + \frac{x}{x + 1}
\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right) + \frac{x}{x + 1}
double f(double x) {
        double r118872 = 1.0;
        double r118873 = x;
        double r118874 = r118873 - r118872;
        double r118875 = r118872 / r118874;
        double r118876 = r118873 + r118872;
        double r118877 = r118873 / r118876;
        double r118878 = r118875 + r118877;
        return r118878;
}

double f(double x) {
        double r118879 = 1.0;
        double r118880 = x;
        double r118881 = r118880 * r118880;
        double r118882 = r118879 * r118879;
        double r118883 = r118881 - r118882;
        double r118884 = r118879 / r118883;
        double r118885 = r118880 + r118879;
        double r118886 = r118884 * r118885;
        double r118887 = r118880 / r118885;
        double r118888 = r118886 + r118887;
        return r118888;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

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

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

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

    \[\leadsto \frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right) + \frac{x}{x + 1}\]

Reproduce

herbie shell --seed 2020047 +o rules:numerics
(FPCore (x)
  :name "Asymptote B"
  :precision binary64
  (+ (/ 1 (- x 1)) (/ x (+ x 1))))