Average Error: 14.5 → 0.1
Time: 2.4s
Precision: 64
\[\frac{1}{x + 1} - \frac{1}{x}\]
\[\frac{\frac{0 - 1}{x}}{x + 1} \cdot 1\]
\frac{1}{x + 1} - \frac{1}{x}
\frac{\frac{0 - 1}{x}}{x + 1} \cdot 1
double code(double x) {
	return ((1.0 / (x + 1.0)) - (1.0 / x));
}
double code(double x) {
	return ((((0.0 - 1.0) / x) / (x + 1.0)) * 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 14.5

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

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

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

    \[\leadsto \frac{\color{blue}{x - \left(x + 1\right)}}{\left(x + 1\right) \cdot \frac{x}{1}}\]
  6. Using strategy rm
  7. Applied associate-*r/13.8

    \[\leadsto \frac{x - \left(x + 1\right)}{\color{blue}{\frac{\left(x + 1\right) \cdot x}{1}}}\]
  8. Applied associate-/r/13.8

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

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

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

Reproduce

herbie shell --seed 2020078 
(FPCore (x)
  :name "2frac (problem 3.3.1)"
  :precision binary64
  (- (/ 1 (+ x 1)) (/ 1 x)))