Average Error: 29.3 → 0.1
Time: 3.6s
Precision: 64
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -13694.02034117937 \lor \neg \left(x \le 12060.12268311564\right):\\ \;\;\;\;\left(\frac{-1}{{x}^{2}} - \frac{3}{x}\right) - \frac{3}{{x}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-\frac{x + 1}{x - 1} \cdot \frac{x + 1}{x - 1}\right) + \frac{\frac{x}{x + 1} \cdot x}{x + 1}}{x \cdot \frac{1}{x + 1} + \frac{x + 1}{x - 1}}\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -13694.02034117937 or 12060.12268311564 < x

    1. Initial program 59.3

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

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

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

    if -13694.02034117937 < x < 12060.12268311564

    1. Initial program 0.1

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

      \[\leadsto \color{blue}{x \cdot \frac{1}{x + 1}} - \frac{x + 1}{x - 1}\]
    4. Using strategy rm
    5. Applied flip--0.1

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

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

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

Reproduce

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