Average Error: 29.5 → 0.2
Time: 5.0m
Precision: 64
Internal Precision: 1344
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -18348.00381699833 \lor \neg \left(x \le 26770.87581489914\right):\\ \;\;\;\;\frac{\frac{1}{{x}^{3}} \cdot \left(-16\right) + \left(\left(-6\right) \cdot \frac{1}{x} + 5 \cdot \frac{-1}{{x}^{2}}\right)}{\frac{1 + x}{x - 1} + \frac{x}{1 + x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(x \cdot \frac{x}{1 + x}\right) \cdot \left(x - 1\right) - \left(\left(1 + x\right) \cdot \frac{1 + x}{x - 1}\right) \cdot \left(1 + x\right)}{x \cdot x - 1}}{\frac{1 + x}{x - 1} + \frac{x}{1 + x}}\\ \end{array}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if x < -18348.00381699833 or 26770.87581489914 < x

    1. Initial program 59.4

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

      \[\leadsto \color{blue}{\frac{\frac{x}{x + 1} \cdot \frac{x}{x + 1} - \frac{x + 1}{x - 1} \cdot \frac{x + 1}{x - 1}}{\frac{x}{x + 1} + \frac{x + 1}{x - 1}}}\]
    4. Taylor expanded around inf 0.3

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

    if -18348.00381699833 < x < 26770.87581489914

    1. Initial program 0.1

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

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

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

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

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

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

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

Runtime

Time bar (total: 5.0m)Debug logProfile

herbie shell --seed 2018214 +o rules:numerics
(FPCore (x)
  :name "Asymptote C"
  (- (/ x (+ x 1)) (/ (+ x 1) (- x 1))))