Average Error: 29.6 → 0.0
Time: 4.4m
Precision: 64
Internal Precision: 1344
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -3.7422431800629266 \cdot 10^{+28} \lor \neg \left(x \le 173218.03867985317\right):\\ \;\;\;\;(\left(1 + \frac{3}{x}\right) \cdot \left(\frac{-1}{x \cdot x}\right) + \left(\frac{-3}{x}\right))_*\\ \mathbf{else}:\\ \;\;\;\;\frac{-(x \cdot 3 + 1)_*}{\left(x - 1\right) \cdot \left(1 + x\right)}\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -3.7422431800629266e+28 or 173218.03867985317 < x

    1. Initial program 60.0

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

      \[\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. Taylor expanded around inf 0.3

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

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

    if -3.7422431800629266e+28 < x < 173218.03867985317

    1. Initial program 1.7

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

      \[\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. Taylor expanded around inf 0.0

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -3.7422431800629266 \cdot 10^{+28} \lor \neg \left(x \le 173218.03867985317\right):\\ \;\;\;\;(\left(1 + \frac{3}{x}\right) \cdot \left(\frac{-1}{x \cdot x}\right) + \left(\frac{-3}{x}\right))_*\\ \mathbf{else}:\\ \;\;\;\;\frac{-(x \cdot 3 + 1)_*}{\left(x - 1\right) \cdot \left(1 + x\right)}\\ \end{array}\]

Runtime

Time bar (total: 4.4m)Debug logProfile

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