Average Error: 28.9 → 0.5
Time: 47.4s
Precision: 64
Internal Precision: 1344
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;\sqrt[3]{{\left(\frac{\left(-1\right) - \frac{3}{x}}{x \cdot x} - \frac{3}{x}\right)}^{3}} \le -0.01091010827941926:\\ \;\;\;\;\log \left(\sqrt{e^{\frac{x}{1 + x} - \frac{1 + x}{x - 1}}}\right) + \log \left(\sqrt{e^{\frac{x}{1 + x} - \frac{1 + x}{x - 1}}}\right)\\ \mathbf{if}\;\sqrt[3]{{\left(\frac{\left(-1\right) - \frac{3}{x}}{x \cdot x} - \frac{3}{x}\right)}^{3}} \le 8.323236187655384 \cdot 10^{+18}:\\ \;\;\;\;\frac{-3}{x} - \frac{1 + \frac{3}{x}}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{1}{x + 1} - \frac{x + 1}{x - 1}\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if (cbrt (pow (- (/ (- (- 1) (/ 3 x)) (* x x)) (/ 3 x)) 3)) < -0.01091010827941926

    1. Initial program 0.0

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

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

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

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

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

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

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

    if -0.01091010827941926 < (cbrt (pow (- (/ (- (- 1) (/ 3 x)) (* x x)) (/ 3 x)) 3)) < 8.323236187655384e+18

    1. Initial program 58.3

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

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

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

    if 8.323236187655384e+18 < (cbrt (pow (- (/ (- (- 1) (/ 3 x)) (* x x)) (/ 3 x)) 3))

    1. Initial program 0.0

      \[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
    2. Using strategy rm
    3. Applied div-inv0.0

      \[\leadsto \color{blue}{x \cdot \frac{1}{x + 1}} - \frac{x + 1}{x - 1}\]
  3. Recombined 3 regimes into one program.

Runtime

Time bar (total: 47.4s)Debug logProfile

herbie shell --seed '#(1071215679 2002590028 935158157 1944352234 2656991306 2955288481)' 
(FPCore (x)
  :name "Asymptote C"
  (- (/ x (+ x 1)) (/ (+ x 1) (- x 1))))