Average Error: 28.7 → 0.1
Time: 22.1s
Precision: 64
Internal Precision: 1408
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot \left(3 + x\right) + 1 \le 3138730169560823.0:\\ \;\;\;\;x \cdot \frac{1}{x + 1} - \frac{x + 1}{x - 1}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + \frac{3}{x}\right) \cdot \frac{-1}{x \cdot x} + \left(-\frac{3}{x}\right)\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if (+ (* x (+ 3 x)) 1) < 3138730169560823.0

    1. Initial program 0.3

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

      \[\leadsto \color{blue}{x \cdot \frac{1}{x + 1}} - \frac{x + 1}{x - 1}\]

    if 3138730169560823.0 < (+ (* x (+ 3 x)) 1)

    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}{\left(1 + \frac{3}{x}\right) \cdot \frac{-1}{x \cdot x} + \left(-\frac{3}{x}\right)}\]
  3. Recombined 2 regimes into one program.

Runtime

Time bar (total: 22.1s)Debug logProfile

herbie shell --seed '#(1070258749 1877548225 2229079127 1588002776 3179087814 1886870650)' 
(FPCore (x)
  :name "Asymptote C"
  (- (/ x (+ x 1)) (/ (+ x 1) (- x 1))))