Average Error: 0.0 → 0.0
Time: 6.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 r52581 = 1.0;
        double r52582 = x;
        double r52583 = r52582 - r52581;
        double r52584 = r52581 / r52583;
        double r52585 = r52582 + r52581;
        double r52586 = r52582 / r52585;
        double r52587 = r52584 + r52586;
        return r52587;
}

double f(double x) {
        double r52588 = 1.0;
        double r52589 = x;
        double r52590 = r52589 * r52589;
        double r52591 = r52588 * r52588;
        double r52592 = r52590 - r52591;
        double r52593 = r52588 / r52592;
        double r52594 = r52589 + r52588;
        double r52595 = r52593 * r52594;
        double r52596 = r52589 / r52594;
        double r52597 = r52595 + r52596;
        return r52597;
}

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