Average Error: 0.0 → 0.0
Time: 11.1s
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 r102346 = 1.0;
        double r102347 = x;
        double r102348 = r102347 - r102346;
        double r102349 = r102346 / r102348;
        double r102350 = r102347 + r102346;
        double r102351 = r102347 / r102350;
        double r102352 = r102349 + r102351;
        return r102352;
}

double f(double x) {
        double r102353 = 1.0;
        double r102354 = x;
        double r102355 = r102354 * r102354;
        double r102356 = r102353 * r102353;
        double r102357 = r102355 - r102356;
        double r102358 = r102353 / r102357;
        double r102359 = r102354 + r102353;
        double r102360 = r102358 * r102359;
        double r102361 = r102354 / r102359;
        double r102362 = r102360 + r102361;
        return r102362;
}

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