Average Error: 10.0 → 0.1
Time: 28.9s
Precision: 64
Internal Precision: 1088
\[\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -16355.841795310165 \lor \neg \left(x \le 134159960.51551194\right):\\ \;\;\;\;\frac{2}{{x}^{7}} + \left(\frac{2}{{x}^{5}} + \frac{\frac{2}{x}}{x \cdot x}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left(x - 2\right) - 2 \cdot x\right) \cdot \left(x - 1\right) + \left(x + x \cdot x\right)}{\left(x \cdot \left(1 + x\right)\right) \cdot \left(x - 1\right)}\\ \end{array}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if x < -16355.841795310165 or 134159960.51551194 < x

    1. Initial program 20.0

      \[\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
    2. Initial simplification20.0

      \[\leadsto \frac{1}{x - 1} + \left(\frac{1}{x + 1} - \frac{2}{x}\right)\]
    3. Taylor expanded around -inf 0.5

      \[\leadsto \color{blue}{2 \cdot \frac{1}{{x}^{5}} + \left(2 \cdot \frac{1}{{x}^{7}} + 2 \cdot \frac{1}{{x}^{3}}\right)}\]
    4. Simplified0.1

      \[\leadsto \color{blue}{\frac{2}{{x}^{7}} + \left(\frac{2}{{x}^{5}} + \frac{\frac{2}{x}}{x \cdot x}\right)}\]

    if -16355.841795310165 < x < 134159960.51551194

    1. Initial program 0.4

      \[\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
    2. Initial simplification0.4

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

      \[\leadsto \frac{1}{x - 1} + \color{blue}{\frac{1 \cdot x - \left(x + 1\right) \cdot 2}{\left(x + 1\right) \cdot x}}\]
    5. Applied frac-add0.0

      \[\leadsto \color{blue}{\frac{1 \cdot \left(\left(x + 1\right) \cdot x\right) + \left(x - 1\right) \cdot \left(1 \cdot x - \left(x + 1\right) \cdot 2\right)}{\left(x - 1\right) \cdot \left(\left(x + 1\right) \cdot x\right)}}\]
    6. Simplified0.1

      \[\leadsto \frac{\color{blue}{\left(x - 1\right) \cdot \left(\left(x - 2\right) - x \cdot 2\right) + \left(x + x \cdot x\right)}}{\left(x - 1\right) \cdot \left(\left(x + 1\right) \cdot x\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -16355.841795310165 \lor \neg \left(x \le 134159960.51551194\right):\\ \;\;\;\;\frac{2}{{x}^{7}} + \left(\frac{2}{{x}^{5}} + \frac{\frac{2}{x}}{x \cdot x}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left(x - 2\right) - 2 \cdot x\right) \cdot \left(x - 1\right) + \left(x + x \cdot x\right)}{\left(x \cdot \left(1 + x\right)\right) \cdot \left(x - 1\right)}\\ \end{array}\]

Runtime

Time bar (total: 28.9s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)' 
(FPCore (x)
  :name "1/(x+1)-2/x+1/(x-1)"
  (+ (- (/ 1 (+ x 1)) (/ 2 x)) (/ 1 (- x 1))))