Average Error: 28.5 → 0.0
Time: 8.3s
Precision: 64
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
\[\frac{-\left(3 + 1 \cdot \frac{1}{x}\right)}{\left(x + 1\right) \cdot \frac{x - 1}{x}}\]
\frac{x}{x + 1} - \frac{x + 1}{x - 1}
\frac{-\left(3 + 1 \cdot \frac{1}{x}\right)}{\left(x + 1\right) \cdot \frac{x - 1}{x}}
double code(double x) {
	return ((double) (((double) (x / ((double) (x + 1.0)))) - ((double) (((double) (x + 1.0)) / ((double) (x - 1.0))))));
}
double code(double x) {
	return ((double) (((double) -(((double) (3.0 + ((double) (1.0 * ((double) (1.0 / x)))))))) / ((double) (((double) (x + 1.0)) * ((double) (((double) (x - 1.0)) / x))))));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 28.5

    \[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
  2. Using strategy rm
  3. Applied clear-num28.5

    \[\leadsto \color{blue}{\frac{1}{\frac{x + 1}{x}}} - \frac{x + 1}{x - 1}\]
  4. Applied frac-sub28.2

    \[\leadsto \color{blue}{\frac{1 \cdot \left(x - 1\right) - \frac{x + 1}{x} \cdot \left(x + 1\right)}{\frac{x + 1}{x} \cdot \left(x - 1\right)}}\]
  5. Taylor expanded around 0 0.0

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

    \[\leadsto \frac{\color{blue}{-\left(3 + 1 \cdot \frac{1}{x}\right)}}{\frac{x + 1}{x} \cdot \left(x - 1\right)}\]
  7. Using strategy rm
  8. Applied div-inv0.1

    \[\leadsto \frac{-\left(3 + 1 \cdot \frac{1}{x}\right)}{\color{blue}{\left(\left(x + 1\right) \cdot \frac{1}{x}\right)} \cdot \left(x - 1\right)}\]
  9. Applied associate-*l*0.1

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

    \[\leadsto \frac{-\left(3 + 1 \cdot \frac{1}{x}\right)}{\left(x + 1\right) \cdot \color{blue}{\frac{x - 1}{x}}}\]
  11. Final simplification0.0

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

Reproduce

herbie shell --seed 2020113 +o rules:numerics
(FPCore (x)
  :name "Asymptote C"
  :precision binary64
  (- (/ x (+ x 1)) (/ (+ x 1) (- x 1))))