Average Error: 28.7 → 0.6
Time: 21.2s
Precision: 64
Internal Precision: 1408
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;(\left(1 + \frac{3}{x}\right) \cdot \left(\frac{-1}{x \cdot x}\right) + \left(\frac{-3}{x}\right))_* \le -9.576494990969397 \cdot 10^{-11}:\\ \;\;\;\;\frac{x}{(\left(x \cdot x\right) \cdot x + 1)_*} \cdot \left(x \cdot x + \left(1 - x\right)\right) - \frac{1 + x}{x - 1}\\ \mathbf{if}\;(\left(1 + \frac{3}{x}\right) \cdot \left(\frac{-1}{x \cdot x}\right) + \left(\frac{-3}{x}\right))_* \le 2.9239057891583022 \cdot 10^{-08}:\\ \;\;\;\;(\left(1 + \frac{3}{x}\right) \cdot \left(\frac{-1}{x \cdot x}\right) + \left(\frac{-3}{x}\right))_*\\ \mathbf{else}:\\ \;\;\;\;(x \cdot \left(3 + x\right) + 1)_*\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if (fma (+ 1 (/ 3 x)) (/ (- 1) (* x x)) (/ (- 3) x)) < -9.576494990969397e-11

    1. Initial program 0.6

      \[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
    2. Using strategy rm
    3. Applied flip3-+0.7

      \[\leadsto \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}\]
    4. Applied associate-/r/0.6

      \[\leadsto \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}\]
    5. Applied simplify0.7

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

    if -9.576494990969397e-11 < (fma (+ 1 (/ 3 x)) (/ (- 1) (* x x)) (/ (- 3) x)) < 2.9239057891583022e-08

    1. Initial program 59.9

      \[\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(3 \cdot \frac{1}{x} + \frac{1}{{x}^{2}}\right)\right)}\]
    3. Applied simplify0.0

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

    if 2.9239057891583022e-08 < (fma (+ 1 (/ 3 x)) (/ (- 1) (* x x)) (/ (- 3) x))

    1. Initial program 0.2

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

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

      \[\leadsto \color{blue}{(x \cdot \left(3 + x\right) + 1)_*}\]
  3. Recombined 3 regimes into one program.
  4. Applied simplify0.6

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;(\left(1 + \frac{3}{x}\right) \cdot \left(\frac{-1}{x \cdot x}\right) + \left(\frac{-3}{x}\right))_* \le -9.576494990969397 \cdot 10^{-11}:\\ \;\;\;\;\frac{x}{(\left(x \cdot x\right) \cdot x + 1)_*} \cdot \left(x \cdot x + \left(1 - x\right)\right) - \frac{1 + x}{x - 1}\\ \mathbf{if}\;(\left(1 + \frac{3}{x}\right) \cdot \left(\frac{-1}{x \cdot x}\right) + \left(\frac{-3}{x}\right))_* \le 2.9239057891583022 \cdot 10^{-08}:\\ \;\;\;\;(\left(1 + \frac{3}{x}\right) \cdot \left(\frac{-1}{x \cdot x}\right) + \left(\frac{-3}{x}\right))_*\\ \mathbf{else}:\\ \;\;\;\;(x \cdot \left(3 + x\right) + 1)_*\\ \end{array}}\]

Runtime

Time bar (total: 21.2s)Debug logProfile

herbie shell --seed '#(1070227846 1561819246 480764335 4016816270 2602869839 2117310382)' +o rules:numerics
(FPCore (x)
  :name "Asymptote C"
  (- (/ x (+ x 1)) (/ (+ x 1) (- x 1))))