Average Error: 29.3 → 0.0
Time: 2.6m
Precision: 64
Internal Precision: 1344
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -3.0568258474207045 \cdot 10^{+44} \lor \neg \left(x \le 152629.32427088282\right):\\ \;\;\;\;\left(-\frac{3}{x}\right) - \frac{1 + \frac{3}{x}}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-\left(x + x\right)\right) - \left(1 + x\right)}{\left(1 + x\right) \cdot \left(x - 1\right)}\\ \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 < -3.0568258474207045e+44 or 152629.32427088282 < x

    1. Initial program 59.8

      \[\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}{\frac{-3}{x} - \frac{1 + \frac{3}{x}}{x \cdot x}}\]

    if -3.0568258474207045e+44 < x < 152629.32427088282

    1. Initial program 3.1

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

      \[\leadsto \color{blue}{\frac{x \cdot \left(x - 1\right) - \left(x + 1\right) \cdot \left(x + 1\right)}{\left(x + 1\right) \cdot \left(x - 1\right)}}\]
    4. Using strategy rm
    5. Applied distribute-lft-in3.0

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

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

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

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;x \le -3.0568258474207045 \cdot 10^{+44} \lor \neg \left(x \le 152629.32427088282\right):\\ \;\;\;\;\left(-\frac{3}{x}\right) - \frac{1 + \frac{3}{x}}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-\left(x + x\right)\right) - \left(1 + x\right)}{\left(1 + x\right) \cdot \left(x - 1\right)}\\ \end{array}}\]

Runtime

Time bar (total: 2.6m)Debug logProfile

herbie shell --seed 2018199 
(FPCore (x)
  :name "Asymptote C"
  (- (/ x (+ x 1)) (/ (+ x 1) (- x 1))))