Average Error: 29.5 → 1.1
Time: 55.7s
Precision: 64
Internal Precision: 1408
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;\frac{-3}{x} - \frac{1 + \frac{3}{x}}{x \cdot x} \le -1.3739957811489437 \cdot 10^{-16}:\\ \;\;\;\;1 + \left(\frac{x}{1 + x} + \left(x \cdot 2\right) \cdot \left(1 + x\right)\right)\\ \mathbf{if}\;\frac{-3}{x} - \frac{1 + \frac{3}{x}}{x \cdot x} \le 6.1000639342661295 \cdot 10^{-09}:\\ \;\;\;\;\frac{-3}{x} - \frac{1 + \frac{3}{x}}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{1 + {x}^{3}} \cdot \left(\left(1 - x\right) + x \cdot x\right) - \frac{1 + x}{x - 1}\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if (- (/ (- 3) x) (/ (+ 1 (/ 3 x)) (* x x))) < -1.3739957811489437e-16

    1. Initial program 1.2

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

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

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

    if -1.3739957811489437e-16 < (- (/ (- 3) x) (/ (+ 1 (/ 3 x)) (* x x))) < 6.1000639342661295e-09

    1. Initial program 60.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 6.1000639342661295e-09 < (- (/ (- 3) x) (/ (+ 1 (/ 3 x)) (* x x)))

    1. Initial program 0.3

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

      \[\leadsto \frac{x}{\color{blue}{\frac{{x}^{3} + {1}^{3}}{x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)}}} - \frac{x + 1}{x - 1}\]
    4. Applied associate-/r/0.3

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

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

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;\frac{-3}{x} - \frac{1 + \frac{3}{x}}{x \cdot x} \le -1.3739957811489437 \cdot 10^{-16}:\\ \;\;\;\;1 + \left(\frac{x}{1 + x} + \left(x \cdot 2\right) \cdot \left(1 + x\right)\right)\\ \mathbf{if}\;\frac{-3}{x} - \frac{1 + \frac{3}{x}}{x \cdot x} \le 6.1000639342661295 \cdot 10^{-09}:\\ \;\;\;\;\frac{-3}{x} - \frac{1 + \frac{3}{x}}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{1 + {x}^{3}} \cdot \left(\left(1 - x\right) + x \cdot x\right) - \frac{1 + x}{x - 1}\\ \end{array}}\]

Runtime

Time bar (total: 55.7s)Debug logProfile

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