Average Error: 29.6 → 0.1
Time: 3.1m
Precision: 64
Internal Precision: 1344
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.99081168843845:\\ \;\;\;\;\left(\frac{-1}{x \cdot x} - \frac{3}{x}\right) - \frac{\frac{3}{x \cdot x}}{x}\\ \mathbf{elif}\;x \le 11157.565510823717:\\ \;\;\;\;\frac{\frac{x}{\sqrt{1 + x}}}{\sqrt{1 + x}} - \frac{1 + x}{x - 1}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{-1}{x \cdot x} - \frac{3}{x}\right) - \frac{\frac{3}{x \cdot x}}{x}\\ \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 < -0.99081168843845 or 11157.565510823717 < x

    1. Initial program 59.1

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

      \[\leadsto \frac{x}{x + 1} - \frac{x + 1}{\color{blue}{\sqrt[3]{\left(\left(x - 1\right) \cdot \left(x - 1\right)\right) \cdot \left(x - 1\right)}}}\]
    4. Applied add-cbrt-cube61.1

      \[\leadsto \frac{x}{x + 1} - \frac{\color{blue}{\sqrt[3]{\left(\left(x + 1\right) \cdot \left(x + 1\right)\right) \cdot \left(x + 1\right)}}}{\sqrt[3]{\left(\left(x - 1\right) \cdot \left(x - 1\right)\right) \cdot \left(x - 1\right)}}\]
    5. Applied cbrt-undiv61.1

      \[\leadsto \frac{x}{x + 1} - \color{blue}{\sqrt[3]{\frac{\left(\left(x + 1\right) \cdot \left(x + 1\right)\right) \cdot \left(x + 1\right)}{\left(\left(x - 1\right) \cdot \left(x - 1\right)\right) \cdot \left(x - 1\right)}}}\]
    6. Taylor expanded around inf 0.5

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

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

    if -0.99081168843845 < x < 11157.565510823717

    1. Initial program 0.0

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

      \[\leadsto \frac{x}{\color{blue}{\sqrt{x + 1} \cdot \sqrt{x + 1}}} - \frac{x + 1}{x - 1}\]
    4. Applied associate-/r*0.1

      \[\leadsto \color{blue}{\frac{\frac{x}{\sqrt{x + 1}}}{\sqrt{x + 1}}} - \frac{x + 1}{x - 1}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.99081168843845:\\ \;\;\;\;\left(\frac{-1}{x \cdot x} - \frac{3}{x}\right) - \frac{\frac{3}{x \cdot x}}{x}\\ \mathbf{elif}\;x \le 11157.565510823717:\\ \;\;\;\;\frac{\frac{x}{\sqrt{1 + x}}}{\sqrt{1 + x}} - \frac{1 + x}{x - 1}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{-1}{x \cdot x} - \frac{3}{x}\right) - \frac{\frac{3}{x \cdot x}}{x}\\ \end{array}\]

Runtime

Time bar (total: 3.1m)Debug logProfile

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