Average Error: 29.1 → 0.1
Time: 5.4s
Precision: binary64
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -9873.4280108723797 \lor \neg \left(x \le 11886.148758601244\right):\\ \;\;\;\;\left(\frac{-1}{{x}^{2}} - \frac{3}{x}\right) - \frac{3}{{x}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\log \left(\sqrt{e^{\frac{x}{x + 1} - \frac{x + 1}{x - 1}}}\right) + \log \left(\sqrt{e^{\frac{x}{x + 1} - \frac{x + 1}{x - 1}}}\right)\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -9873.4280108723797 or 11886.148758601244 < x

    1. Initial program 59.2

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

      \[\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.0

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

    if -9873.4280108723797 < x < 11886.148758601244

    1. Initial program 0.1

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

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

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

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

      \[\leadsto \log \color{blue}{\left(e^{\frac{x}{x + 1} - \frac{x + 1}{x - 1}}\right)}\]
    7. Using strategy rm
    8. Applied add-sqr-sqrt0.1

      \[\leadsto \log \color{blue}{\left(\sqrt{e^{\frac{x}{x + 1} - \frac{x + 1}{x - 1}}} \cdot \sqrt{e^{\frac{x}{x + 1} - \frac{x + 1}{x - 1}}}\right)}\]
    9. Applied log-prod0.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -9873.4280108723797 \lor \neg \left(x \le 11886.148758601244\right):\\ \;\;\;\;\left(\frac{-1}{{x}^{2}} - \frac{3}{x}\right) - \frac{3}{{x}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\log \left(\sqrt{e^{\frac{x}{x + 1} - \frac{x + 1}{x - 1}}}\right) + \log \left(\sqrt{e^{\frac{x}{x + 1} - \frac{x + 1}{x - 1}}}\right)\\ \end{array}\]

Reproduce

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