Average Error: 0.0 → 0.0
Time: 4.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 r89467 = 1.0;
        double r89468 = x;
        double r89469 = r89468 - r89467;
        double r89470 = r89467 / r89469;
        double r89471 = r89468 + r89467;
        double r89472 = r89468 / r89471;
        double r89473 = r89470 + r89472;
        return r89473;
}

double f(double x) {
        double r89474 = 1.0;
        double r89475 = x;
        double r89476 = r89475 * r89475;
        double r89477 = r89474 * r89474;
        double r89478 = r89476 - r89477;
        double r89479 = r89474 / r89478;
        double r89480 = r89475 + r89474;
        double r89481 = r89479 * r89480;
        double r89482 = r89475 / r89480;
        double r89483 = r89481 + r89482;
        return r89483;
}

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