Average Error: 14.3 → 0.2
Time: 1.1m
Precision: 64
Internal Precision: 896
\[\frac{1}{x + 1} - \frac{1}{x}\]
\[\begin{array}{l} \mathbf{if}\;\frac{1}{x + 1} - \frac{1}{x} \le -2.222617399267654:\\ \;\;\;\;(\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 3.159795906265593 \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)) < -2.222617399267654 or 3.159795906265593e-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 -2.222617399267654 < (- (/ 1 (+ x 1)) (/ 1 x)) < 3.159795906265593e-05

    1. Initial program 28.7

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

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

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

herbie shell --seed '#(1070706311 3771791028 4128836681 4194990999 2341756049 504035650)' +o rules:numerics
(FPCore (x)
  :name "2frac (problem 3.3.1)"
  (- (/ 1 (+ x 1)) (/ 1 x)))