Average Error: 0.0 → 0.0
Time: 2.5s
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 r102235 = 1.0;
        double r102236 = x;
        double r102237 = r102236 - r102235;
        double r102238 = r102235 / r102237;
        double r102239 = r102236 + r102235;
        double r102240 = r102236 / r102239;
        double r102241 = r102238 + r102240;
        return r102241;
}

double f(double x) {
        double r102242 = 1.0;
        double r102243 = x;
        double r102244 = r102243 * r102243;
        double r102245 = r102242 * r102242;
        double r102246 = r102244 - r102245;
        double r102247 = r102242 / r102246;
        double r102248 = r102243 + r102242;
        double r102249 = r102247 * r102248;
        double r102250 = r102243 / r102248;
        double r102251 = r102249 + r102250;
        return r102251;
}

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 2020083 
(FPCore (x)
  :name "Asymptote B"
  :precision binary64
  (+ (/ 1 (- x 1)) (/ x (+ x 1))))