Average Error: 0.0 → 0.0
Time: 11.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 r117805 = 1.0;
        double r117806 = x;
        double r117807 = r117806 - r117805;
        double r117808 = r117805 / r117807;
        double r117809 = r117806 + r117805;
        double r117810 = r117806 / r117809;
        double r117811 = r117808 + r117810;
        return r117811;
}

double f(double x) {
        double r117812 = 1.0;
        double r117813 = x;
        double r117814 = r117813 * r117813;
        double r117815 = r117812 * r117812;
        double r117816 = r117814 - r117815;
        double r117817 = r117812 / r117816;
        double r117818 = r117813 + r117812;
        double r117819 = r117817 * r117818;
        double r117820 = r117813 / r117818;
        double r117821 = r117819 + r117820;
        return r117821;
}

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