Average Error: 0.0 → 0.0
Time: 2.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 r190007 = 1.0;
        double r190008 = x;
        double r190009 = r190008 - r190007;
        double r190010 = r190007 / r190009;
        double r190011 = r190008 + r190007;
        double r190012 = r190008 / r190011;
        double r190013 = r190010 + r190012;
        return r190013;
}

double f(double x) {
        double r190014 = 1.0;
        double r190015 = x;
        double r190016 = r190015 * r190015;
        double r190017 = r190014 * r190014;
        double r190018 = r190016 - r190017;
        double r190019 = r190014 / r190018;
        double r190020 = r190015 + r190014;
        double r190021 = r190019 * r190020;
        double r190022 = r190015 / r190020;
        double r190023 = r190021 + r190022;
        return r190023;
}

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