Average Error: 29.2 → 0.1
Time: 2.3s
Precision: binary64
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
\[\frac{\frac{-1 - x \cdot 3}{x + 1}}{-1 + x}\]
\frac{x}{x + 1} - \frac{x + 1}{x - 1}
\frac{\frac{-1 - x \cdot 3}{x + 1}}{-1 + x}
(FPCore (x) :precision binary64 (- (/ x (+ x 1.0)) (/ (+ x 1.0) (- x 1.0))))
(FPCore (x)
 :precision binary64
 (/ (/ (- -1.0 (* x 3.0)) (+ x 1.0)) (+ -1.0 x)))
double code(double x) {
	return (x / (x + 1.0)) - ((x + 1.0) / (x - 1.0));
}
double code(double x) {
	return ((-1.0 - (x * 3.0)) / (x + 1.0)) / (-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 29.2

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

    \[\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. Simplified30.3

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

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

    \[\leadsto \frac{\color{blue}{-1 - x \cdot 3}}{x \cdot x + -1}\]
  7. Using strategy rm
  8. Applied difference-of-sqr--1_binary64_274414.6

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

    \[\leadsto \color{blue}{\frac{\frac{-1 - x \cdot 3}{x + 1}}{x - 1}}\]
  10. Final simplification0.1

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

Reproduce

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