Average Error: 0.0 → 0.0
Time: 2.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 r86655 = 1.0;
        double r86656 = x;
        double r86657 = r86656 - r86655;
        double r86658 = r86655 / r86657;
        double r86659 = r86656 + r86655;
        double r86660 = r86656 / r86659;
        double r86661 = r86658 + r86660;
        return r86661;
}

double f(double x) {
        double r86662 = 1.0;
        double r86663 = x;
        double r86664 = r86663 * r86663;
        double r86665 = r86662 * r86662;
        double r86666 = r86664 - r86665;
        double r86667 = r86662 / r86666;
        double r86668 = r86663 + r86662;
        double r86669 = r86667 * r86668;
        double r86670 = r86663 / r86668;
        double r86671 = r86669 + r86670;
        return r86671;
}

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