Average Error: 0.0 → 0.0
Time: 3.1s
Precision: 64
\[\frac{1}{x - 1} + \frac{x}{x + 1}\]
\[\left(\frac{1}{x \cdot x - 1 \cdot 1} \cdot x + 1 \cdot \frac{1}{x \cdot x - 1 \cdot 1}\right) + \frac{x}{x + 1}\]
\frac{1}{x - 1} + \frac{x}{x + 1}
\left(\frac{1}{x \cdot x - 1 \cdot 1} \cdot x + 1 \cdot \frac{1}{x \cdot x - 1 \cdot 1}\right) + \frac{x}{x + 1}
double f(double x) {
        double r190985 = 1.0;
        double r190986 = x;
        double r190987 = r190986 - r190985;
        double r190988 = r190985 / r190987;
        double r190989 = r190986 + r190985;
        double r190990 = r190986 / r190989;
        double r190991 = r190988 + r190990;
        return r190991;
}

double f(double x) {
        double r190992 = 1.0;
        double r190993 = x;
        double r190994 = r190993 * r190993;
        double r190995 = r190992 * r190992;
        double r190996 = r190994 - r190995;
        double r190997 = r190992 / r190996;
        double r190998 = r190997 * r190993;
        double r190999 = r190992 * r190997;
        double r191000 = r190998 + r190999;
        double r191001 = r190993 + r190992;
        double r191002 = r190993 / r191001;
        double r191003 = r191000 + r191002;
        return r191003;
}

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. Using strategy rm
  6. Applied distribute-lft-in0.0

    \[\leadsto \color{blue}{\left(\frac{1}{x \cdot x - 1 \cdot 1} \cdot x + \frac{1}{x \cdot x - 1 \cdot 1} \cdot 1\right)} + \frac{x}{x + 1}\]
  7. Simplified0.0

    \[\leadsto \left(\frac{1}{x \cdot x - 1 \cdot 1} \cdot x + \color{blue}{1 \cdot \frac{1}{x \cdot x - 1 \cdot 1}}\right) + \frac{x}{x + 1}\]
  8. Final simplification0.0

    \[\leadsto \left(\frac{1}{x \cdot x - 1 \cdot 1} \cdot x + 1 \cdot \frac{1}{x \cdot x - 1 \cdot 1}\right) + \frac{x}{x + 1}\]

Reproduce

herbie shell --seed 2020059 
(FPCore (x)
  :name "Asymptote B"
  :precision binary64
  (+ (/ 1 (- x 1)) (/ x (+ x 1))))