Average Error: 0.0 → 0.0
Time: 1.6s
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 r166144 = 1.0;
        double r166145 = x;
        double r166146 = r166145 - r166144;
        double r166147 = r166144 / r166146;
        double r166148 = r166145 + r166144;
        double r166149 = r166145 / r166148;
        double r166150 = r166147 + r166149;
        return r166150;
}

double f(double x) {
        double r166151 = 1.0;
        double r166152 = x;
        double r166153 = r166152 * r166152;
        double r166154 = r166151 * r166151;
        double r166155 = r166153 - r166154;
        double r166156 = r166151 / r166155;
        double r166157 = r166152 + r166151;
        double r166158 = r166156 * r166157;
        double r166159 = r166152 / r166157;
        double r166160 = r166158 + r166159;
        return r166160;
}

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