Average Error: 0.0 → 0.0
Time: 8.3s
Precision: 64
\[\frac{1}{x - 1} + \frac{x}{x + 1}\]
\[\frac{1 \cdot \left(x + 1\right)}{x \cdot x - 1 \cdot 1} + \frac{x}{x + 1}\]
\frac{1}{x - 1} + \frac{x}{x + 1}
\frac{1 \cdot \left(x + 1\right)}{x \cdot x - 1 \cdot 1} + \frac{x}{x + 1}
double f(double x) {
        double r5604037 = 1.0;
        double r5604038 = x;
        double r5604039 = r5604038 - r5604037;
        double r5604040 = r5604037 / r5604039;
        double r5604041 = r5604038 + r5604037;
        double r5604042 = r5604038 / r5604041;
        double r5604043 = r5604040 + r5604042;
        return r5604043;
}

double f(double x) {
        double r5604044 = 1.0;
        double r5604045 = x;
        double r5604046 = r5604045 + r5604044;
        double r5604047 = r5604044 * r5604046;
        double r5604048 = r5604045 * r5604045;
        double r5604049 = r5604044 * r5604044;
        double r5604050 = r5604048 - r5604049;
        double r5604051 = r5604047 / r5604050;
        double r5604052 = r5604045 / r5604046;
        double r5604053 = r5604051 + r5604052;
        return r5604053;
}

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 associate-*l/0.0

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

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

Reproduce

herbie shell --seed 2019174 
(FPCore (x)
  :name "Asymptote B"
  (+ (/ 1.0 (- x 1.0)) (/ x (+ x 1.0))))