Average Error: 29.5 → 0.8
Time: 57.6s
Precision: 64
Internal Precision: 1408
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;\left(\sqrt[3]{\frac{-3}{x} - \frac{1 + \frac{3}{x}}{x \cdot x}} \cdot \sqrt[3]{\frac{-3}{x} - \frac{1 + \frac{3}{x}}{x \cdot x}}\right) \cdot \sqrt[3]{\frac{-3}{x} - \frac{1 + \frac{3}{x}}{x \cdot x}} \le -1.4788644928520164 \cdot 10^{+29}:\\ \;\;\;\;x \cdot \left(3 + x\right) + 1\\ \mathbf{if}\;\left(\sqrt[3]{\frac{-3}{x} - \frac{1 + \frac{3}{x}}{x \cdot x}} \cdot \sqrt[3]{\frac{-3}{x} - \frac{1 + \frac{3}{x}}{x \cdot x}}\right) \cdot \sqrt[3]{\frac{-3}{x} - \frac{1 + \frac{3}{x}}{x \cdot x}} \le 471082971.45187527:\\ \;\;\;\;\frac{-3}{x} - \frac{1 + \frac{3}{x}}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x \cdot x - 1} \cdot \left(x - 1\right) - \frac{x + 1}{x - 1}\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if (* (* (cbrt (- (/ (- 3) x) (/ (+ 1 (/ 3 x)) (* x x)))) (cbrt (- (/ (- 3) x) (/ (+ 1 (/ 3 x)) (* x x))))) (cbrt (- (/ (- 3) x) (/ (+ 1 (/ 3 x)) (* x x))))) < -1.4788644928520164e+29

    1. Initial program 0.0

      \[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
    2. Taylor expanded around 0 0

      \[\leadsto \color{blue}{{x}^{2} + \left(1 + 3 \cdot x\right)}\]
    3. Applied simplify0

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

    if -1.4788644928520164e+29 < (* (* (cbrt (- (/ (- 3) x) (/ (+ 1 (/ 3 x)) (* x x)))) (cbrt (- (/ (- 3) x) (/ (+ 1 (/ 3 x)) (* x x))))) (cbrt (- (/ (- 3) x) (/ (+ 1 (/ 3 x)) (* x x))))) < 471082971.45187527

    1. Initial program 57.6

      \[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
    2. Taylor expanded around inf 1.9

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

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

    if 471082971.45187527 < (* (* (cbrt (- (/ (- 3) x) (/ (+ 1 (/ 3 x)) (* x x)))) (cbrt (- (/ (- 3) x) (/ (+ 1 (/ 3 x)) (* x x))))) (cbrt (- (/ (- 3) x) (/ (+ 1 (/ 3 x)) (* x x)))))

    1. Initial program 0.0

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

      \[\leadsto \frac{x}{\color{blue}{\frac{x \cdot x - 1 \cdot 1}{x - 1}}} - \frac{x + 1}{x - 1}\]
    4. Applied associate-/r/0.0

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

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

Runtime

Time bar (total: 57.6s)Debug logProfile

herbie shell --seed '#(1070833653 108281690 3330367898 3632331308 3494323072 43156186)' 
(FPCore (x)
  :name "Asymptote C"
  (- (/ x (+ x 1)) (/ (+ x 1) (- x 1))))