Average Error: 29.5 → 0.8
Time: 46.7s
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 105993668.57667193:\\ \;\;\;\;\frac{-3}{x} - \frac{1 + \frac{3}{x}}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x + 1} - \left(x + 1\right) \cdot \frac{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))))) < 105993668.57667193

    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 105993668.57667193 < (* (* (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 div-inv0.0

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

Runtime

Time bar (total: 46.7s)Debug logProfile

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