Average Error: 0.0 → 0.0
Time: 10.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 r5316796 = 1.0;
        double r5316797 = x;
        double r5316798 = r5316797 - r5316796;
        double r5316799 = r5316796 / r5316798;
        double r5316800 = r5316797 + r5316796;
        double r5316801 = r5316797 / r5316800;
        double r5316802 = r5316799 + r5316801;
        return r5316802;
}

double f(double x) {
        double r5316803 = 1.0;
        double r5316804 = x;
        double r5316805 = r5316804 * r5316804;
        double r5316806 = r5316803 * r5316803;
        double r5316807 = r5316805 - r5316806;
        double r5316808 = r5316803 / r5316807;
        double r5316809 = r5316804 + r5316803;
        double r5316810 = r5316808 * r5316809;
        double r5316811 = r5316804 / r5316809;
        double r5316812 = r5316810 + r5316811;
        return r5316812;
}

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 2019172 
(FPCore (x)
  :name "Asymptote B"
  (+ (/ 1.0 (- x 1.0)) (/ x (+ x 1.0))))