The wiki for machine epsilon says:

"Machine epsilon gives an upper bound on the relative error due to rounding in floating point arithmetic"

If machine epsilon is the upper bound on the relative error, why does the spacing between floating point numbers actually get bigger for larger numbers? For example in MATLAB:

eps(1) = 2.220446049250313e-016 (machine epsilon)
eps(2) = 4.440892098500626e-016
eps(4) = 8.881784197001252e-016
eps(8) = 1.776356839400251e-015
eps(realmax) = 1.995840309534720e+292

So how is eps the upper bound on the relative error if it is less than all of those numbers?


The Matlab command help eps says the following:

D = EPS(X), is the positive distance from ABS(X) to the next larger in magnitude floating point number of the same precision as X. X may be either double precision or single precision.

In other words, if $\varepsilon_\mathsf{mach}$ is the relative error due to floating point, as defined in the Wikipedia article, then $\mbox{eps}(x)$ will, for any normal $x$, be $\hat{x}\varepsilon_\mathsf{mach}$, where $\hat{x}$ is the largest power of two such that $|\hat{x}|\leq|x|$.

Calling eps without an argument will give you the relative error, calling eps(x) with an argument will give you the absolute error for that argument.

| cite | improve this answer | |
  • 3
    $\begingroup$ See also the definition of Unit in the last place, or ulp. $\endgroup$ – Aron Ahmadia Aug 25 '13 at 19:18
  • $\begingroup$ Ah I see, so when I compute for instance: eps(4)/4, eps(5)/5, eps(6)/6, eps(7)/7, I see that the maximum is indeed eps. $\endgroup$ – Maxwell'sSemen Aug 25 '13 at 19:52
  • $\begingroup$ On an unrelated note, why is the tex in your post not showing properly? I can still see the markup. $\endgroup$ – Maxwell'sSemen Aug 25 '13 at 19:56
  • $\begingroup$ @Maxwell'sSemen: Are you using noscript? $\endgroup$ – Dan Aug 27 '13 at 19:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.