Average Error: 0.0 → 0.0
Time: 1.5s
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 r110762 = 1.0;
        double r110763 = x;
        double r110764 = r110763 - r110762;
        double r110765 = r110762 / r110764;
        double r110766 = r110763 + r110762;
        double r110767 = r110763 / r110766;
        double r110768 = r110765 + r110767;
        return r110768;
}

double f(double x) {
        double r110769 = 1.0;
        double r110770 = x;
        double r110771 = r110770 * r110770;
        double r110772 = r110769 * r110769;
        double r110773 = r110771 - r110772;
        double r110774 = r110769 / r110773;
        double r110775 = r110770 + r110769;
        double r110776 = r110774 * r110775;
        double r110777 = r110770 / r110775;
        double r110778 = r110776 + r110777;
        return r110778;
}

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