Average Error: 14.1 → 0.4
Time: 1.7m
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 -253010.42398527495:\\ \;\;\;\;(\left(\sqrt{\frac{1}{x + 1}}\right) \cdot \left(\sqrt{\frac{1}{x + 1}}\right) + \left(-\frac{1}{x}\right))_*\\ \mathbf{if}\;\frac{1}{x + 1} - \frac{1}{x} \le 6.600238285609028 \cdot 10^{-05}:\\ \;\;\;\;\frac{1}{{x}^{3}} - \left(\frac{1}{{x}^{4}} + {x}^{\left(-2\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;(\left(\sqrt{\frac{1}{x + 1}}\right) \cdot \left(\sqrt{\frac{1}{x + 1}}\right) + \left(-\frac{1}{x}\right))_*\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if (- (/ 1 (+ x 1)) (/ 1 x)) < -253010.42398527495 or 6.600238285609028e-05 < (- (/ 1 (+ x 1)) (/ 1 x))

    1. Initial program 0.0

      \[\frac{1}{x + 1} - \frac{1}{x}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt0.0

      \[\leadsto \color{blue}{\sqrt{\frac{1}{x + 1}} \cdot \sqrt{\frac{1}{x + 1}}} - \frac{1}{x}\]
    4. Applied fma-neg0.0

      \[\leadsto \color{blue}{(\left(\sqrt{\frac{1}{x + 1}}\right) \cdot \left(\sqrt{\frac{1}{x + 1}}\right) + \left(-\frac{1}{x}\right))_*}\]

    if -253010.42398527495 < (- (/ 1 (+ x 1)) (/ 1 x)) < 6.600238285609028e-05

    1. Initial program 27.9

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

      \[\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.8

      \[\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.7m)Debug logProfile

herbie shell --seed '#(1071725047 233389029 2036512464 3988615230 2972226563 1111574017)' +o rules:numerics
(FPCore (x)
  :name "2frac (problem 3.3.1)"
  (- (/ 1 (+ x 1)) (/ 1 x)))