Average Error: 29.5 → 0.2
Time: 37.3s
Precision: binary64
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.00639665183005644 \lor \neg \left(x \le 13089.4086349961854\right):\\ \;\;\;\;\left(\frac{-1}{{x}^{2}} - \frac{3}{x}\right) - \frac{3}{{x}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(x \cdot \left(x \cdot x - 1 \cdot 1\right)\right) \cdot \left(\sqrt{x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)} \cdot \left(x - 1\right)\right) - \left(\sqrt{x + 1} \cdot \left(x + 1\right)\right) \cdot \left(\sqrt{{x}^{3} + {1}^{3}} \cdot \left(x \cdot x - 1 \cdot 1\right)\right)}{\left(\sqrt{x + 1} \cdot \left(x + 1\right)\right) \cdot \left(\sqrt{x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)} \cdot \left(x - 1\right)\right)}}{\sqrt{x + 1} \cdot \left(x - 1\right)}\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -1.00639665183005644 or 13089.4086349961854 < x

    1. Initial program 59.1

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

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

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

    if -1.00639665183005644 < x < 13089.4086349961854

    1. Initial program 0.1

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

      \[\leadsto \frac{x}{\color{blue}{\sqrt{x + 1} \cdot \sqrt{x + 1}}} - \frac{x + 1}{x - 1}\]
    4. Applied associate-/r*0.1

      \[\leadsto \color{blue}{\frac{\frac{x}{\sqrt{x + 1}}}{\sqrt{x + 1}}} - \frac{x + 1}{x - 1}\]
    5. Using strategy rm
    6. Applied frac-sub0.1

      \[\leadsto \color{blue}{\frac{\frac{x}{\sqrt{x + 1}} \cdot \left(x - 1\right) - \sqrt{x + 1} \cdot \left(x + 1\right)}{\sqrt{x + 1} \cdot \left(x - 1\right)}}\]
    7. Using strategy rm
    8. Applied flip-+0.1

      \[\leadsto \frac{\frac{x}{\sqrt{x + 1}} \cdot \left(x - 1\right) - \sqrt{x + 1} \cdot \color{blue}{\frac{x \cdot x - 1 \cdot 1}{x - 1}}}{\sqrt{x + 1} \cdot \left(x - 1\right)}\]
    9. Applied flip3-+0.1

      \[\leadsto \frac{\frac{x}{\sqrt{x + 1}} \cdot \left(x - 1\right) - \sqrt{\color{blue}{\frac{{x}^{3} + {1}^{3}}{x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)}}} \cdot \frac{x \cdot x - 1 \cdot 1}{x - 1}}{\sqrt{x + 1} \cdot \left(x - 1\right)}\]
    10. Applied sqrt-div0.1

      \[\leadsto \frac{\frac{x}{\sqrt{x + 1}} \cdot \left(x - 1\right) - \color{blue}{\frac{\sqrt{{x}^{3} + {1}^{3}}}{\sqrt{x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)}}} \cdot \frac{x \cdot x - 1 \cdot 1}{x - 1}}{\sqrt{x + 1} \cdot \left(x - 1\right)}\]
    11. Applied frac-times0.1

      \[\leadsto \frac{\frac{x}{\sqrt{x + 1}} \cdot \left(x - 1\right) - \color{blue}{\frac{\sqrt{{x}^{3} + {1}^{3}} \cdot \left(x \cdot x - 1 \cdot 1\right)}{\sqrt{x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)} \cdot \left(x - 1\right)}}}{\sqrt{x + 1} \cdot \left(x - 1\right)}\]
    12. Applied flip--0.1

      \[\leadsto \frac{\frac{x}{\sqrt{x + 1}} \cdot \color{blue}{\frac{x \cdot x - 1 \cdot 1}{x + 1}} - \frac{\sqrt{{x}^{3} + {1}^{3}} \cdot \left(x \cdot x - 1 \cdot 1\right)}{\sqrt{x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)} \cdot \left(x - 1\right)}}{\sqrt{x + 1} \cdot \left(x - 1\right)}\]
    13. Applied frac-times0.1

      \[\leadsto \frac{\color{blue}{\frac{x \cdot \left(x \cdot x - 1 \cdot 1\right)}{\sqrt{x + 1} \cdot \left(x + 1\right)}} - \frac{\sqrt{{x}^{3} + {1}^{3}} \cdot \left(x \cdot x - 1 \cdot 1\right)}{\sqrt{x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)} \cdot \left(x - 1\right)}}{\sqrt{x + 1} \cdot \left(x - 1\right)}\]
    14. Applied frac-sub0.1

      \[\leadsto \frac{\color{blue}{\frac{\left(x \cdot \left(x \cdot x - 1 \cdot 1\right)\right) \cdot \left(\sqrt{x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)} \cdot \left(x - 1\right)\right) - \left(\sqrt{x + 1} \cdot \left(x + 1\right)\right) \cdot \left(\sqrt{{x}^{3} + {1}^{3}} \cdot \left(x \cdot x - 1 \cdot 1\right)\right)}{\left(\sqrt{x + 1} \cdot \left(x + 1\right)\right) \cdot \left(\sqrt{x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)} \cdot \left(x - 1\right)\right)}}}{\sqrt{x + 1} \cdot \left(x - 1\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.00639665183005644 \lor \neg \left(x \le 13089.4086349961854\right):\\ \;\;\;\;\left(\frac{-1}{{x}^{2}} - \frac{3}{x}\right) - \frac{3}{{x}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(x \cdot \left(x \cdot x - 1 \cdot 1\right)\right) \cdot \left(\sqrt{x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)} \cdot \left(x - 1\right)\right) - \left(\sqrt{x + 1} \cdot \left(x + 1\right)\right) \cdot \left(\sqrt{{x}^{3} + {1}^{3}} \cdot \left(x \cdot x - 1 \cdot 1\right)\right)}{\left(\sqrt{x + 1} \cdot \left(x + 1\right)\right) \cdot \left(\sqrt{x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)} \cdot \left(x - 1\right)\right)}}{\sqrt{x + 1} \cdot \left(x - 1\right)}\\ \end{array}\]

Reproduce

herbie shell --seed 2020149 
(FPCore (x)
  :name "Asymptote C"
  :precision binary64
  (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))