# Machine epsilon (eps)

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.

• See also the definition of Unit in the last place, or ulp. – Aron Ahmadia Aug 25 '13 at 19:18
• 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. – Maxwell'sSemen Aug 25 '13 at 19:52
• On an unrelated note, why is the tex in your post not showing properly? I can still see the markup. – Maxwell'sSemen Aug 25 '13 at 19:56
• @Maxwell'sSemen: Are you using noscript? – Dan Aug 27 '13 at 19:51