Average Error: 28.7 → 0.6
Time: 23.5s
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 \frac{-1}{x \cdot x} + \left(-\frac{3}{x}\right) \le -9.576494990969397 \cdot 10^{-11}:\\ \;\;\;\;\frac{x}{x + 1} - \frac{\sqrt{x + 1}}{1} \cdot \frac{\sqrt{x + 1}}{x - 1}\\ \mathbf{if}\;\left(1 + \frac{3}{x}\right) \cdot \frac{-1}{x \cdot x} + \left(-\frac{3}{x}\right) \le 2.9239057891583022 \cdot 10^{-08}:\\ \;\;\;\;\left(1 + \frac{3}{x}\right) \cdot \frac{-1}{x \cdot x} + \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 (+ (* (+ 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 *-un-lft-identity0.6

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

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

      \[\leadsto \frac{x}{x + 1} - \color{blue}{\frac{\sqrt{x + 1}}{1} \cdot \frac{\sqrt{x + 1}}{x - 1}}\]

    if -9.576494990969397e-11 < (+ (* (+ 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 \frac{-1}{x \cdot x} + \left(-\frac{3}{x}\right)}\]

    if 2.9239057891583022e-08 < (+ (* (+ 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.

Runtime

Time bar (total: 23.5s)Debug logProfile

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