Average Error: 15.1 → 0.1
Time: 2.9s
Precision: binary64
\[\frac{1}{x + 1} - \frac{1}{x - 1} \]
\[\frac{\frac{-2}{1 + x}}{x - 1} \]
\frac{1}{x + 1} - \frac{1}{x - 1}
\frac{\frac{-2}{1 + x}}{x - 1}
(FPCore (x) :precision binary64 (- (/ 1.0 (+ x 1.0)) (/ 1.0 (- x 1.0))))
(FPCore (x) :precision binary64 (/ (/ -2.0 (+ 1.0 x)) (- x 1.0)))
double code(double x) {
	return (1.0 / (x + 1.0)) - (1.0 / (x - 1.0));
}
double code(double x) {
	return (-2.0 / (1.0 + x)) / (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 15.1

    \[\frac{1}{x + 1} - \frac{1}{x - 1} \]
  2. Applied egg-rr14.5

    \[\leadsto \color{blue}{\frac{\frac{\left(x - 1\right) - \left(1 + x\right)}{1 + x}}{x - 1}} \]
  3. Taylor expanded in x around 0 0.1

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

    \[\leadsto \frac{\frac{-2}{1 + x}}{x - 1} \]

Reproduce

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