Average Error: 0.0 → 0.0
Time: 3.2s
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 r181874 = 1.0;
        double r181875 = x;
        double r181876 = r181875 - r181874;
        double r181877 = r181874 / r181876;
        double r181878 = r181875 + r181874;
        double r181879 = r181875 / r181878;
        double r181880 = r181877 + r181879;
        return r181880;
}

double f(double x) {
        double r181881 = 1.0;
        double r181882 = x;
        double r181883 = r181882 * r181882;
        double r181884 = r181881 * r181881;
        double r181885 = r181883 - r181884;
        double r181886 = r181881 / r181885;
        double r181887 = r181882 + r181881;
        double r181888 = r181886 * r181887;
        double r181889 = r181882 / r181887;
        double r181890 = r181888 + r181889;
        return r181890;
}

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))))