Average Error: 14.5 → 0.3
Time: 22.1s
Precision: 64
Internal precision: 128
\[\frac{1}{x + 1} - \frac{1}{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -3833755296400741.5:\\ \;\;\;\;\frac{\frac{1}{x}}{{x}^2} - \frac{\frac{1}{x}}{x}\\ \mathbf{if}\;x \le 9.757059776157302 \cdot 10^{+20}:\\ \;\;\;\;\frac{x - \left(1 + x\right)}{\left(x + 1\right) \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x}}{{x}^2} - \frac{\frac{1}{x}}{x}\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes.
  2. if x < -3833755296400741.5 or 9.757059776157302e+20 < x

    1. Initial program 29.0

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{x}}{{x}^2} - \frac{\frac{1}{x}}{x}}\]

    if -3833755296400741.5 < x < 9.757059776157302e+20

    1. Initial program 1.5

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

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

      \[\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: 22.1s) Debug log

Please include this information when filing a bug report:

herbie --seed '#(919572473 3678994413 1766500800 3475007827 3190906205 2374886118)'
(FPCore (x)
  :name "2frac (problem 3.3.1)"
  (- (/ 1 (+ x 1)) (/ 1 x)))