Average Error: 29.5 → 0.3
Time: 9.5m
Precision: 64
Internal Precision: 1344
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;\left(\frac{\frac{-3}{x}}{x \cdot x} - \frac{1}{x \cdot x}\right) + \frac{-3}{x} \le -6.91932921351675 \cdot 10^{-14}:\\ \;\;\;\;\frac{x}{x + 1} - \sqrt{1 + x} \cdot \frac{\sqrt{x + 1}}{x - 1}\\ \mathbf{if}\;\left(\frac{\frac{-3}{x}}{x \cdot x} - \frac{1}{x \cdot x}\right) + \frac{-3}{x} \le 3.8562700347660344 \cdot 10^{-07}:\\ \;\;\;\;\left(\frac{\frac{-3}{x}}{x \cdot x} - \frac{1}{x \cdot x}\right) + \frac{-3}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}}}{\sqrt[3]{x + 1}} - \frac{x + 1}{x - 1}\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if (+ (- (/ (/ -3 x) (* x x)) (/ 1 (* x x))) (/ -3 x)) < -6.91932921351675e-14

    1. Initial program 0.8

      \[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity0.8

      \[\leadsto \frac{x}{x + 1} - \frac{x + 1}{\color{blue}{1 \cdot \left(x - 1\right)}}\]
    4. Applied add-sqr-sqrt0.8

      \[\leadsto \frac{x}{x + 1} - \frac{\color{blue}{\sqrt{x + 1} \cdot \sqrt{x + 1}}}{1 \cdot \left(x - 1\right)}\]
    5. Applied times-frac0.8

      \[\leadsto \frac{x}{x + 1} - \color{blue}{\frac{\sqrt{x + 1}}{1} \cdot \frac{\sqrt{x + 1}}{x - 1}}\]
    6. Applied simplify0.8

      \[\leadsto \frac{x}{x + 1} - \color{blue}{\sqrt{1 + x}} \cdot \frac{\sqrt{x + 1}}{x - 1}\]

    if -6.91932921351675e-14 < (+ (- (/ (/ -3 x) (* x x)) (/ 1 (* x x))) (/ -3 x)) < 3.8562700347660344e-07

    1. Initial program 59.9

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

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

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

    if 3.8562700347660344e-07 < (+ (- (/ (/ -3 x) (* x x)) (/ 1 (* x x))) (/ -3 x))

    1. Initial program 0.2

      \[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt0.2

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

      \[\leadsto \color{blue}{\frac{\frac{x}{\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}}}{\sqrt[3]{x + 1}}} - \frac{x + 1}{x - 1}\]
  3. Recombined 3 regimes into one program.

Runtime

Time bar (total: 9.5m)Debug logProfile

herbie shell --seed '#(1071373924 2949776965 1885069702 3247780810 90874544 2263903749)' 
(FPCore (x)
  :name "Asymptote C"
  (- (/ x (+ x 1)) (/ (+ x 1) (- x 1))))