Average Error: 14.2 → 0.2
Time: 2.1m
Precision: 64
Internal Precision: 832
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;\frac{1}{x + 1} - \frac{1}{x - 1} \le 4.5082903407156913 \cdot 10^{-131}:\\ \;\;\;\;\left(-\left(\frac{2}{{x}^{6}} + \frac{\frac{2}{x}}{x}\right)\right) - \frac{2}{{x}^{4}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x + 1} - \frac{(x \cdot x + 1)_* + x}{(x \cdot \left(x \cdot x\right) + \left(-1\right))_*}\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if (- (/ 1 (+ x 1)) (/ 1 (- x 1))) < 4.5082903407156913e-131

    1. Initial program 28.5

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

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

      \[\leadsto \color{blue}{\left(\frac{-2}{x \cdot x} + \frac{-2}{{x}^{6}}\right) - \frac{2}{{x}^{4}}}\]
    4. Using strategy rm
    5. Applied associate-/r*0.3

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

    if 4.5082903407156913e-131 < (- (/ 1 (+ x 1)) (/ 1 (- x 1)))

    1. Initial program 0.0

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

      \[\leadsto \frac{1}{x + 1} - \frac{1}{\color{blue}{\frac{{x}^{3} - {1}^{3}}{x \cdot x + \left(1 \cdot 1 + x \cdot 1\right)}}}\]
    4. Applied associate-/r/0.0

      \[\leadsto \frac{1}{x + 1} - \color{blue}{\frac{1}{{x}^{3} - {1}^{3}} \cdot \left(x \cdot x + \left(1 \cdot 1 + x \cdot 1\right)\right)}\]
    5. Applied add-cube-cbrt0.0

      \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{1}{x + 1}} \cdot \sqrt[3]{\frac{1}{x + 1}}\right) \cdot \sqrt[3]{\frac{1}{x + 1}}} - \frac{1}{{x}^{3} - {1}^{3}} \cdot \left(x \cdot x + \left(1 \cdot 1 + x \cdot 1\right)\right)\]
    6. Applied prod-diff0.0

      \[\leadsto \color{blue}{(\left(\sqrt[3]{\frac{1}{x + 1}} \cdot \sqrt[3]{\frac{1}{x + 1}}\right) \cdot \left(\sqrt[3]{\frac{1}{x + 1}}\right) + \left(-\left(x \cdot x + \left(1 \cdot 1 + x \cdot 1\right)\right) \cdot \frac{1}{{x}^{3} - {1}^{3}}\right))_* + (\left(-\left(x \cdot x + \left(1 \cdot 1 + x \cdot 1\right)\right)\right) \cdot \left(\frac{1}{{x}^{3} - {1}^{3}}\right) + \left(\left(x \cdot x + \left(1 \cdot 1 + x \cdot 1\right)\right) \cdot \frac{1}{{x}^{3} - {1}^{3}}\right))_*}\]
    7. Applied simplify0.0

      \[\leadsto \color{blue}{\left(\frac{1}{x + 1} - \frac{x + (x \cdot x + 1)_*}{(x \cdot \left(x \cdot x\right) + \left(-1\right))_*}\right)} + (\left(-\left(x \cdot x + \left(1 \cdot 1 + x \cdot 1\right)\right)\right) \cdot \left(\frac{1}{{x}^{3} - {1}^{3}}\right) + \left(\left(x \cdot x + \left(1 \cdot 1 + x \cdot 1\right)\right) \cdot \frac{1}{{x}^{3} - {1}^{3}}\right))_*\]
    8. Applied simplify0.0

      \[\leadsto \left(\frac{1}{x + 1} - \frac{x + (x \cdot x + 1)_*}{(x \cdot \left(x \cdot x\right) + \left(-1\right))_*}\right) + \color{blue}{0}\]
  3. Recombined 2 regimes into one program.
  4. Applied simplify0.2

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;\frac{1}{x + 1} - \frac{1}{x - 1} \le 4.5082903407156913 \cdot 10^{-131}:\\ \;\;\;\;\left(-\left(\frac{2}{{x}^{6}} + \frac{\frac{2}{x}}{x}\right)\right) - \frac{2}{{x}^{4}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x + 1} - \frac{(x \cdot x + 1)_* + x}{(x \cdot \left(x \cdot x\right) + \left(-1\right))_*}\\ \end{array}}\]

Runtime

Time bar (total: 2.1m)Debug logProfile

herbie shell --seed '#(1071948828 1180510430 2986424009 997076509 406109801 420189285)' +o rules:numerics
(FPCore (x)
  :name "Asymptote A"
  (- (/ 1 (+ x 1)) (/ 1 (- x 1))))