Average Error: 29.5 → 0.1
Time: 4.0m
Precision: 64
Internal Precision: 1344
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -30083.671341272853 \lor \neg \left(x \le 12411.753463578973\right):\\ \;\;\;\;(\left(\frac{-1}{x \cdot x}\right) \cdot \left(\frac{3}{x}\right) + \left(\frac{-1}{x \cdot x} - \frac{3}{x}\right))_*\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{(\left(\frac{x}{(x \cdot \left(x \cdot x\right) + 1)_*}\right) \cdot \left(x \cdot x + \left(1 - x\right)\right) + \left(-\frac{1 + x}{x - 1}\right))_* \cdot \left(\left(\frac{x}{1 + x} - \frac{1 + x}{x - 1}\right) \cdot \left(\frac{x}{1 + x} - \frac{1 + x}{x - 1}\right)\right)}\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -30083.671341272853 or 12411.753463578973 < 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(3 \cdot \frac{1}{{x}^{3}} + \left(\frac{1}{{x}^{2}} + 3 \cdot \frac{1}{x}\right)\right)}\]
    3. Simplified0.0

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

    if -30083.671341272853 < x < 12411.753463578973

    1. Initial program 0.1

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

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

      \[\leadsto \sqrt[3]{\left(\left(\frac{x}{x + 1} - \frac{x + 1}{x - 1}\right) \cdot \left(\frac{x}{x + 1} - \frac{x + 1}{x - 1}\right)\right) \cdot \left(\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}\right)}\]
    6. Applied associate-/r/0.1

      \[\leadsto \sqrt[3]{\left(\left(\frac{x}{x + 1} - \frac{x + 1}{x - 1}\right) \cdot \left(\frac{x}{x + 1} - \frac{x + 1}{x - 1}\right)\right) \cdot \left(\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}\right)}\]
    7. Applied fma-neg0.1

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

      \[\leadsto \sqrt[3]{\left(\left(\frac{x}{x + 1} - \frac{x + 1}{x - 1}\right) \cdot \left(\frac{x}{x + 1} - \frac{x + 1}{x - 1}\right)\right) \cdot (\color{blue}{\left(\frac{x}{(x \cdot \left(x \cdot x\right) + 1)_*}\right)} \cdot \left(x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)\right) + \left(-\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 -30083.671341272853 \lor \neg \left(x \le 12411.753463578973\right):\\ \;\;\;\;(\left(\frac{-1}{x \cdot x}\right) \cdot \left(\frac{3}{x}\right) + \left(\frac{-1}{x \cdot x} - \frac{3}{x}\right))_*\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{(\left(\frac{x}{(x \cdot \left(x \cdot x\right) + 1)_*}\right) \cdot \left(x \cdot x + \left(1 - x\right)\right) + \left(-\frac{1 + x}{x - 1}\right))_* \cdot \left(\left(\frac{x}{1 + x} - \frac{1 + x}{x - 1}\right) \cdot \left(\frac{x}{1 + x} - \frac{1 + x}{x - 1}\right)\right)}\\ \end{array}\]

Runtime

Time bar (total: 4.0m)Debug logProfile

BaselineHerbieOracleSpan%
Regimes31.20.10.031.299.9%
herbie shell --seed 2018263 +o rules:numerics
(FPCore (x)
  :name "Asymptote C"
  (- (/ x (+ x 1)) (/ (+ x 1) (- x 1))))