Average Error: 29.7 → 0.4
Time: 2.1s
Precision: binary64
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.0086104922468278 \lor \neg \left(x \le 0.994922346711485051\right):\\ \;\;\;\;\frac{\left(-3\right) - \frac{1}{x}}{x} - \frac{3}{{x}^{3}}\\ \mathbf{else}:\\ \;\;\;\;1 + x \cdot \left(3 + x \cdot 1\right)\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -1.0086104922468278 or 0.994922346711485051 < x

    1. Initial program 58.6

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

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

      \[\leadsto \color{blue}{\frac{-1}{x} \cdot \left(\frac{1}{x} + 3\right) - \frac{3}{{x}^{3}}}\]
    4. Using strategy rm
    5. Applied associate-*l/0.4

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

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

    if -1.0086104922468278 < x < 0.994922346711485051

    1. Initial program 0.0

      \[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
    2. Taylor expanded around 0 0.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.0086104922468278 \lor \neg \left(x \le 0.994922346711485051\right):\\ \;\;\;\;\frac{\left(-3\right) - \frac{1}{x}}{x} - \frac{3}{{x}^{3}}\\ \mathbf{else}:\\ \;\;\;\;1 + x \cdot \left(3 + x \cdot 1\right)\\ \end{array}\]

Reproduce

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