Average Error: 0.0 → 0.0
Time: 6.0s
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 r101166 = 1.0;
        double r101167 = x;
        double r101168 = r101167 - r101166;
        double r101169 = r101166 / r101168;
        double r101170 = r101167 + r101166;
        double r101171 = r101167 / r101170;
        double r101172 = r101169 + r101171;
        return r101172;
}

double f(double x) {
        double r101173 = 1.0;
        double r101174 = x;
        double r101175 = r101174 * r101174;
        double r101176 = r101173 * r101173;
        double r101177 = r101175 - r101176;
        double r101178 = r101173 / r101177;
        double r101179 = r101174 + r101173;
        double r101180 = r101178 * r101179;
        double r101181 = r101174 / r101179;
        double r101182 = r101180 + r101181;
        return r101182;
}

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))))