Average Error: 14.7 → 0.0
Time: 16.0s
Precision: 64
Ground Truth: 128
\[\frac{1}{x + 1} - \frac{1}{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -8.658073314327725 \cdot 10^{-05}:\\ \;\;\;\;\frac{1}{{x}^{3}} - \left(\frac{1}{{x}^{4}} + {x}^{\left(-2\right)}\right)\\ \mathbf{if}\;x \le 2486138704986031.0:\\ \;\;\;\;\frac{x - \left(1 + x\right)}{\left(x + 1\right) \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{{x}^{3}} - \left(\frac{1}{{x}^{4}} + {x}^{\left(-2\right)}\right)\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes.
  2. if x < -8.658073314327725e-05 or 2486138704986031.0 < x

    1. Initial program 29.4

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

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

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

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

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

    if -8.658073314327725e-05 < x < 2486138704986031.0

    1. Initial program 0.7

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

Total time: 16.0s Debug log

Please include this information when filing a bug report:

herbie --seed '#(3361196376 1818039471 2480134366 3803070597 1215164070 3576802717)'
(FPCore (x)
  :name "NMSE problem 3.3.1"
  (- (/ 1 (+ x 1)) (/ 1 x)))