Average Error: 0.0 → 0.0
Time: 3.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 r72810 = 1.0;
        double r72811 = x;
        double r72812 = r72811 - r72810;
        double r72813 = r72810 / r72812;
        double r72814 = r72811 + r72810;
        double r72815 = r72811 / r72814;
        double r72816 = r72813 + r72815;
        return r72816;
}

double f(double x) {
        double r72817 = 1.0;
        double r72818 = x;
        double r72819 = r72818 * r72818;
        double r72820 = r72817 * r72817;
        double r72821 = r72819 - r72820;
        double r72822 = r72817 / r72821;
        double r72823 = r72818 + r72817;
        double r72824 = r72822 * r72823;
        double r72825 = r72818 / r72823;
        double r72826 = r72824 + r72825;
        return r72826;
}

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