Average Error: 29.3 → 0.0
Time: 3.5s
Precision: binary64
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
\[\frac{-1}{x \cdot x - 1 \cdot 1} - \frac{x}{1 + x} \cdot \frac{3}{x - 1}\]
\frac{x}{x + 1} - \frac{x + 1}{x - 1}
\frac{-1}{x \cdot x - 1 \cdot 1} - \frac{x}{1 + x} \cdot \frac{3}{x - 1}
double code(double x) {
	return ((double) ((x / ((double) (x + 1.0))) - (((double) (x + 1.0)) / ((double) (x - 1.0)))));
}
double code(double x) {
	return ((double) ((((double) -(1.0)) / ((double) (((double) (x * x)) - ((double) (1.0 * 1.0))))) - ((double) ((x / ((double) (1.0 + x))) * (3.0 / ((double) (x - 1.0)))))));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program Error: 29.3 bits

    \[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
  2. Using strategy rm
  3. Applied frac-subError: 30.4 bits

    \[\leadsto \color{blue}{\frac{x \cdot \left(x - 1\right) - \left(x + 1\right) \cdot \left(x + 1\right)}{\left(x + 1\right) \cdot \left(x - 1\right)}}\]
  4. SimplifiedError: 30.4 bits

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

    \[\leadsto \frac{\color{blue}{-\left(3 \cdot x + 1\right)}}{x \cdot x - 1 \cdot 1}\]
  6. SimplifiedError: 14.7 bits

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

    \[\leadsto \color{blue}{\frac{-1}{x \cdot x - 1 \cdot 1} - \frac{x \cdot 3}{x \cdot x - 1 \cdot 1}}\]
  9. SimplifiedError: 0.0 bits

    \[\leadsto \frac{-1}{x \cdot x - 1 \cdot 1} - \color{blue}{\frac{x}{1 + x} \cdot \frac{3}{x - 1}}\]
  10. Final simplificationError: 0.0 bits

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

Reproduce

herbie shell --seed 2020200 
(FPCore (x)
  :name "Asymptote C"
  :precision binary64
  (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))