Average Error: 9.9 → 0.2
Time: 5.7s
Precision: 64
\[\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
\[\frac{2}{{x}^{3} - 1 \cdot x}\]
\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}
\frac{2}{{x}^{3} - 1 \cdot x}
double f(double x) {
        double r142955 = 1.0;
        double r142956 = x;
        double r142957 = r142956 + r142955;
        double r142958 = r142955 / r142957;
        double r142959 = 2.0;
        double r142960 = r142959 / r142956;
        double r142961 = r142958 - r142960;
        double r142962 = r142956 - r142955;
        double r142963 = r142955 / r142962;
        double r142964 = r142961 + r142963;
        return r142964;
}

double f(double x) {
        double r142965 = 2.0;
        double r142966 = x;
        double r142967 = 3.0;
        double r142968 = pow(r142966, r142967);
        double r142969 = 1.0;
        double r142970 = r142969 * r142966;
        double r142971 = r142968 - r142970;
        double r142972 = r142965 / r142971;
        return r142972;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original9.9
Target0.3
Herbie0.2
\[\frac{2}{x \cdot \left(x \cdot x - 1\right)}\]

Derivation

  1. Initial program 9.9

    \[\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
  2. Using strategy rm
  3. Applied frac-sub26.2

    \[\leadsto \color{blue}{\frac{1 \cdot x - \left(x + 1\right) \cdot 2}{\left(x + 1\right) \cdot x}} + \frac{1}{x - 1}\]
  4. Applied frac-add25.9

    \[\leadsto \color{blue}{\frac{\left(1 \cdot x - \left(x + 1\right) \cdot 2\right) \cdot \left(x - 1\right) + \left(\left(x + 1\right) \cdot x\right) \cdot 1}{\left(\left(x + 1\right) \cdot x\right) \cdot \left(x - 1\right)}}\]
  5. Taylor expanded around 0 0.3

    \[\leadsto \frac{\color{blue}{2}}{\left(\left(x + 1\right) \cdot x\right) \cdot \left(x - 1\right)}\]
  6. Taylor expanded around 0 0.2

    \[\leadsto \frac{2}{\color{blue}{{x}^{3} - 1 \cdot x}}\]
  7. Final simplification0.2

    \[\leadsto \frac{2}{{x}^{3} - 1 \cdot x}\]

Reproduce

herbie shell --seed 2020024 
(FPCore (x)
  :name "3frac (problem 3.3.3)"
  :precision binary64

  :herbie-target
  (/ 2 (* x (- (* x x) 1)))

  (+ (- (/ 1 (+ x 1)) (/ 2 x)) (/ 1 (- x 1))))