Average Error: 29.1 → 0.1
Time: 1.1m
Precision: 64
Internal Precision: 1344
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -11245.771677819655 \lor \neg \left(x \le 10310.829037773878\right):\\ \;\;\;\;\left(-\frac{3}{x}\right) - \frac{1 + \frac{3}{x}}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{1 + x} - \left(1 + x\right) \cdot \frac{1}{x - 1}\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -11245.771677819655 or 10310.829037773878 < 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(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 -11245.771677819655 < x < 10310.829037773878

    1. Initial program 0.1

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

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

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

Runtime

Time bar (total: 1.1m)Debug logProfile

herbie shell --seed '#(1071501266 3581234924 1086666455 2685055582 1243441566 1802958749)' 
(FPCore (x)
  :name "Asymptote C"
  (- (/ x (+ x 1)) (/ (+ x 1) (- x 1))))