Average Error: 29.0 → 0.2
Time: 51.1s
Precision: 64
Internal Precision: 1408
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x}{x + 1} - \frac{x + 1}{x - 1} \le 5.66093705467452 \cdot 10^{-07}:\\ \;\;\;\;\left(\frac{-3}{x} + \frac{-1}{x \cdot x}\right) + \frac{\frac{-3}{x}}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x \cdot x - x}{1 + x} - \left(1 + x\right)}{-1 + x}\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if (- (/ x (+ x 1)) (/ (+ x 1) (- x 1))) < 5.66093705467452e-07

    1. Initial program 59.1

      \[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
    2. Using strategy rm
    3. Applied add-log-exp59.1

      \[\leadsto \frac{x}{x + 1} - \color{blue}{\log \left(e^{\frac{x + 1}{x - 1}}\right)}\]
    4. Applied add-log-exp59.1

      \[\leadsto \color{blue}{\log \left(e^{\frac{x}{x + 1}}\right)} - \log \left(e^{\frac{x + 1}{x - 1}}\right)\]
    5. Applied diff-log59.1

      \[\leadsto \color{blue}{\log \left(\frac{e^{\frac{x}{x + 1}}}{e^{\frac{x + 1}{x - 1}}}\right)}\]
    6. Applied simplify59.1

      \[\leadsto \log \color{blue}{\left(e^{\frac{x}{1 + x} - \frac{1 + x}{x - 1}}\right)}\]
    7. Taylor expanded around inf 59.2

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

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

    if 5.66093705467452e-07 < (- (/ x (+ x 1)) (/ (+ x 1) (- x 1)))

    1. Initial program 0.1

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

      \[\leadsto \frac{x}{x + 1} - \color{blue}{\frac{1}{\frac{x - 1}{x + 1}}}\]
    4. Using strategy rm
    5. Applied frac-sub0.1

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

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

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

Runtime

Time bar (total: 51.1s)Debug logProfile

herbie shell --seed '#(1070991898 1055468627 4280279443 640792587 928206309 3646738750)' 
(FPCore (x)
  :name "Asymptote C"
  (- (/ x (+ x 1)) (/ (+ x 1) (- x 1))))