Average Error: 29.7 → 0.2
Time: 33.4s
Precision: 64
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x}{x + 1} - \frac{x + 1}{x - 1} \le 2.90429134486 \cdot 10^{-6}:\\ \;\;\;\;\left(\frac{-1}{{x}^{2}} - \frac{3}{x}\right) - \frac{3}{{x}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left(\left(\sqrt[3]{x - 1} \cdot \sqrt[3]{x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)}\right) \cdot \left(x - 1\right)\right) - \left(x + 1\right) \cdot \left(\left(\sqrt[3]{x \cdot x - 1 \cdot 1} \cdot \sqrt[3]{{x}^{3} + {1}^{3}}\right) \cdot \sqrt[3]{x + 1}\right)}{\left(x + 1\right) \cdot \left(\left(\sqrt[3]{x - 1} \cdot \sqrt[3]{x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)}\right) \cdot \left(x - 1\right)\right)}\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))) < 2.9042913448629193e-06

    1. Initial program 59.0

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

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

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

    if 2.9042913448629193e-06 < (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0)))

    1. Initial program 0.1

      \[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity0.1

      \[\leadsto \frac{x}{x + 1} - \frac{x + 1}{\color{blue}{1 \cdot \left(x - 1\right)}}\]
    4. Applied add-cube-cbrt0.1

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

      \[\leadsto \frac{x}{x + 1} - \color{blue}{\frac{\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}}{1} \cdot \frac{\sqrt[3]{x + 1}}{x - 1}}\]
    6. Simplified0.1

      \[\leadsto \frac{x}{x + 1} - \color{blue}{\left(\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}\right)} \cdot \frac{\sqrt[3]{x + 1}}{x - 1}\]
    7. Using strategy rm
    8. Applied flip-+0.1

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

      \[\leadsto \frac{x}{x + 1} - \left(\sqrt[3]{x + 1} \cdot \color{blue}{\frac{\sqrt[3]{x \cdot x - 1 \cdot 1}}{\sqrt[3]{x - 1}}}\right) \cdot \frac{\sqrt[3]{x + 1}}{x - 1}\]
    10. Applied flip3-+0.1

      \[\leadsto \frac{x}{x + 1} - \left(\sqrt[3]{\color{blue}{\frac{{x}^{3} + {1}^{3}}{x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)}}} \cdot \frac{\sqrt[3]{x \cdot x - 1 \cdot 1}}{\sqrt[3]{x - 1}}\right) \cdot \frac{\sqrt[3]{x + 1}}{x - 1}\]
    11. Applied cbrt-div0.1

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

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

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

      \[\leadsto \color{blue}{\frac{x \cdot \left(\left(\sqrt[3]{x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)} \cdot \sqrt[3]{x - 1}\right) \cdot \left(x - 1\right)\right) - \left(x + 1\right) \cdot \left(\left(\sqrt[3]{{x}^{3} + {1}^{3}} \cdot \sqrt[3]{x \cdot x - 1 \cdot 1}\right) \cdot \sqrt[3]{x + 1}\right)}{\left(x + 1\right) \cdot \left(\left(\sqrt[3]{x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)} \cdot \sqrt[3]{x - 1}\right) \cdot \left(x - 1\right)\right)}}\]
    15. Simplified0.1

      \[\leadsto \frac{\color{blue}{x \cdot \left(\left(\sqrt[3]{x - 1} \cdot \sqrt[3]{x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)}\right) \cdot \left(x - 1\right)\right) - \left(x + 1\right) \cdot \left(\left(\sqrt[3]{x \cdot x - 1 \cdot 1} \cdot \sqrt[3]{{x}^{3} + {1}^{3}}\right) \cdot \sqrt[3]{x + 1}\right)}}{\left(x + 1\right) \cdot \left(\left(\sqrt[3]{x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)} \cdot \sqrt[3]{x - 1}\right) \cdot \left(x - 1\right)\right)}\]
    16. Simplified0.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{x + 1} - \frac{x + 1}{x - 1} \le 2.90429134486 \cdot 10^{-6}:\\ \;\;\;\;\left(\frac{-1}{{x}^{2}} - \frac{3}{x}\right) - \frac{3}{{x}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left(\left(\sqrt[3]{x - 1} \cdot \sqrt[3]{x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)}\right) \cdot \left(x - 1\right)\right) - \left(x + 1\right) \cdot \left(\left(\sqrt[3]{x \cdot x - 1 \cdot 1} \cdot \sqrt[3]{{x}^{3} + {1}^{3}}\right) \cdot \sqrt[3]{x + 1}\right)}{\left(x + 1\right) \cdot \left(\left(\sqrt[3]{x - 1} \cdot \sqrt[3]{x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)}\right) \cdot \left(x - 1\right)\right)}\\ \end{array}\]

Reproduce

herbie shell --seed 2020129 
(FPCore (x)
  :name "Asymptote C"
  :precision binary64
  (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))