Average Error: 0.6 → 0.6
Time: 10.0s
Precision: 64
Internal Precision: 320
\[\frac{1}{x + 1} - \frac{1}{x}\]
\[\frac{1}{x + 1} - \frac{1}{x}\]

Error

Bits error versus x

Derivation

  1. Initial program 0.6

    \[\left(\frac{\left(real->posit(1)\right)}{\left(\frac{x}{\left(real->posit(1)\right)}\right)}\right) - \left(\frac{\left(real->posit(1)\right)}{x}\right)\]
  2. Final simplification0.6

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

Reproduce

herbie shell --seed 2019094 +o rules:numerics
(FPCore (x)
  :name "2frac (problem 3.3.1)"
  (-.p16 (/.p16 (real->posit16 1) (+.p16 x (real->posit16 1))) (/.p16 (real->posit16 1) x)))