Average Error: 29.0 → 0.2
Time: 55.5s
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{-1}{x \cdot x} - \frac{3}{x}\right) - \frac{\frac{3}{x}}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{x - 1} \cdot x - \frac{1 + x}{\sqrt[3]{x - 1}} \cdot \frac{1 + x}{\sqrt[3]{x - 1}}}{\left(x + 1\right) \cdot \sqrt[3]{x - 1}}\\ \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{-1}{x \cdot x} - \frac{3}{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 add-cube-cbrt0.2

      \[\leadsto \frac{x}{x + 1} - \frac{x + 1}{\color{blue}{\left(\sqrt[3]{x - 1} \cdot \sqrt[3]{x - 1}\right) \cdot \sqrt[3]{x - 1}}}\]
    4. Applied *-un-lft-identity0.2

      \[\leadsto \frac{x}{x + 1} - \frac{\color{blue}{1 \cdot \left(x + 1\right)}}{\left(\sqrt[3]{x - 1} \cdot \sqrt[3]{x - 1}\right) \cdot \sqrt[3]{x - 1}}\]
    5. Applied times-frac0.2

      \[\leadsto \frac{x}{x + 1} - \color{blue}{\frac{1}{\sqrt[3]{x - 1} \cdot \sqrt[3]{x - 1}} \cdot \frac{x + 1}{\sqrt[3]{x - 1}}}\]
    6. Using strategy rm
    7. Applied associate-*r/0.2

      \[\leadsto \frac{x}{x + 1} - \color{blue}{\frac{\frac{1}{\sqrt[3]{x - 1} \cdot \sqrt[3]{x - 1}} \cdot \left(x + 1\right)}{\sqrt[3]{x - 1}}}\]
    8. Applied frac-sub0.2

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

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

Runtime

Time bar (total: 55.5s)Debug logProfile

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