Average Error: 0.0 → 0.0
Time: 5.8s
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 r89659 = 1.0;
        double r89660 = x;
        double r89661 = r89660 - r89659;
        double r89662 = r89659 / r89661;
        double r89663 = r89660 + r89659;
        double r89664 = r89660 / r89663;
        double r89665 = r89662 + r89664;
        return r89665;
}

double f(double x) {
        double r89666 = 1.0;
        double r89667 = x;
        double r89668 = r89667 * r89667;
        double r89669 = r89666 * r89666;
        double r89670 = r89668 - r89669;
        double r89671 = r89666 / r89670;
        double r89672 = r89667 + r89666;
        double r89673 = r89671 * r89672;
        double r89674 = r89667 / r89672;
        double r89675 = r89673 + r89674;
        return r89675;
}

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