Average Error: 29.5 → 0.2
Time: 54.6s
Precision: 64
Internal Precision: 1344
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x}{x + 1} - \frac{x + 1}{x - 1} \le 7.416016917401288 \cdot 10^{-06}:\\ \;\;\;\;\frac{-3}{x} - \frac{1 + \frac{3}{x}}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;e^{\log \left(\frac{x}{x + 1} - \frac{x + 1}{x - 1}\right)}\\ \end{array}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (- (/ x (+ x 1)) (/ (+ x 1) (- x 1))) < 7.416016917401288e-06

    1. Initial program 58.8

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

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

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

    if 7.416016917401288e-06 < (- (/ x (+ x 1)) (/ (+ x 1) (- x 1)))

    1. Initial program 0.1

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

      \[\leadsto \color{blue}{e^{\log \left(\frac{x}{x + 1} - \frac{x + 1}{x - 1}\right)}}\]
  3. Recombined 2 regimes into one program.

Runtime

Time bar (total: 54.6s)Debug logProfile

herbie shell --seed 2018296 
(FPCore (x)
  :name "Asymptote C"
  (- (/ x (+ x 1)) (/ (+ x 1) (- x 1))))