Average Error: 14.8 → 0.2
Time: 1.0m
Precision: 64
Internal Precision: 832
\[\frac{1}{x + 1} - \frac{1}{x}\]
\[\begin{array}{l} \mathbf{if}\;\frac{1}{x + 1} - \frac{1}{x} \le -6.498231427768268 \cdot 10^{-18}:\\ \;\;\;\;\frac{1}{x + 1} - \frac{1}{x}\\ \mathbf{if}\;\frac{1}{x + 1} - \frac{1}{x} \le 3.4873870185326 \cdot 10^{-310}:\\ \;\;\;\;\frac{1}{{x}^{3}} - \left(\frac{1}{{x}^{4}} + {x}^{\left(-2\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x + 1} - \frac{1}{x}\\ \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 (- (/ 1 (+ x 1)) (/ 1 x)) < -6.498231427768268e-18 or 3.4873870185326e-310 < (- (/ 1 (+ x 1)) (/ 1 x))

    1. Initial program 0.3

      \[\frac{1}{x + 1} - \frac{1}{x}\]

    if -6.498231427768268e-18 < (- (/ 1 (+ x 1)) (/ 1 x)) < 3.4873870185326e-310

    1. Initial program 30.4

      \[\frac{1}{x + 1} - \frac{1}{x}\]
    2. Taylor expanded around inf 0.7

      \[\leadsto \color{blue}{\frac{1}{{x}^{3}} - \left(\frac{1}{{x}^{4}} + \frac{1}{{x}^{2}}\right)}\]
    3. Using strategy rm
    4. Applied pow-flip0.0

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

Runtime

Time bar (total: 1.0m)Debug logProfile

herbie shell --seed 2018170 +o rules:numerics
(FPCore (x)
  :name "2frac (problem 3.3.1)"
  (- (/ 1 (+ x 1)) (/ 1 x)))