Average Error: 14.2 → 0.0
Time: 14.8s
Precision: 64
Internal precision: 896
\[\frac{1}{x + 1} - \frac{1}{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -8005246051280362.0:\\ \;\;\;\;\frac{1}{{x}^{3}} - \left({x}^{\left(-2\right)} + \frac{1}{{x}^{4}}\right)\\ \mathbf{if}\;x \le 9271942351367.576:\\ \;\;\;\;\frac{x - \left(1 + x\right)}{\left(x + 1\right) \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{{x}^{3}} - \left({x}^{\left(-2\right)} + \frac{1}{{x}^{4}}\right)\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes.
  2. if x < -8005246051280362.0 or 9271942351367.576 < x

    1. Initial program 28.5

      \[\frac{1}{x + 1} - \frac{1}{x}\]
    2. Applied taylor 0.8

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

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

      \[\leadsto \frac{1}{{x}^{3}} - \left(\frac{1}{\color{blue}{{x}^{2}}} + \frac{1}{{x}^{4}}\right)\]
    6. Applied pow-flip 0.0

      \[\leadsto \frac{1}{{x}^{3}} - \left(\color{blue}{{x}^{\left(-2\right)}} + \frac{1}{{x}^{4}}\right)\]

    if -8005246051280362.0 < x < 9271942351367.576

    1. Initial program 1.0

      \[\frac{1}{x + 1} - \frac{1}{x}\]
    2. Using strategy rm
    3. Applied frac-sub 0.0

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

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

Runtime

Time bar (total: 14.8s) Debug log

Please include this information when filing a bug report:

herbie shell --seed '#(3283856077 3183919125 3399458751 396155847 3688194147 1862413033)'
(FPCore (x)
  :name "2frac (problem 3.3.1)"
  (- (/ 1 (+ x 1)) (/ 1 x)))