Average Error: 0.0 → 0.0
Time: 4.3s
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 r110933 = 1.0;
        double r110934 = x;
        double r110935 = r110934 - r110933;
        double r110936 = r110933 / r110935;
        double r110937 = r110934 + r110933;
        double r110938 = r110934 / r110937;
        double r110939 = r110936 + r110938;
        return r110939;
}

double f(double x) {
        double r110940 = 1.0;
        double r110941 = x;
        double r110942 = r110941 * r110941;
        double r110943 = r110940 * r110940;
        double r110944 = r110942 - r110943;
        double r110945 = r110940 / r110944;
        double r110946 = r110941 + r110940;
        double r110947 = r110945 * r110946;
        double r110948 = r110941 / r110946;
        double r110949 = r110947 + r110948;
        return r110949;
}

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. Using strategy rm
  6. Applied add-log-exp0.0

    \[\leadsto \frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right) + \color{blue}{\log \left(e^{\frac{x}{x + 1}}\right)}\]
  7. Applied add-log-exp0.0

    \[\leadsto \color{blue}{\log \left(e^{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right)}\right)} + \log \left(e^{\frac{x}{x + 1}}\right)\]
  8. Applied sum-log0.0

    \[\leadsto \color{blue}{\log \left(e^{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right)} \cdot e^{\frac{x}{x + 1}}\right)}\]
  9. Simplified0.0

    \[\leadsto \log \color{blue}{\left(e^{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right) + \frac{x}{x + 1}}\right)}\]
  10. 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 2019308 
(FPCore (x)
  :name "Asymptote B"
  :precision binary64
  (+ (/ 1 (- x 1)) (/ x (+ x 1))))