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

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

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

    \[\leadsto \frac{\color{blue}{x + \left(-2 - x\right)}}{\left(x + 1\right) \cdot \left(x - 1\right)}\]
  5. Simplified13.9

    \[\leadsto \frac{x + \left(-2 - x\right)}{\color{blue}{-1 + x \cdot x}}\]
  6. Using strategy rm
  7. Applied frac-2neg_binary64_486313.9

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

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

    \[\leadsto \frac{2}{\color{blue}{1 - x \cdot x}}\]
  10. Using strategy rm
  11. Applied *-un-lft-identity_binary64_48520.4

    \[\leadsto \frac{2}{\color{blue}{1 \cdot 1} - x \cdot x}\]
  12. Applied difference-of-squares_binary64_48210.4

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

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

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

Reproduce

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