Machine epsilon
Show older comments
What does it mean for MATLAB to have a machine epsilon 2.2204e-16? Does that mean we can only be sure of a number up to the 15th decimal place, so something else?
Thanks.
Accepted Answer
More Answers (1)
Walter Roberson
on 18 Jan 2012
1 vote
The value is the same as eps(1) which is described at http://www.mathworks.com/help/techdoc/ref/eps.html
4 Comments
Richard
on 18 Jan 2012
Richard
on 18 Jan 2012
Walter Roberson
on 18 Jan 2012
"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"
That says that d = eps(1) is the smallest positive value such that (1+d) is exactly representable and is different than 1.
In hex representation of the binary floating point numbers,
>> num2hex(1)
3ff0000000000000
>> num2hex(1+eps(1))
3ff0000000000001
1+eps(1) is the smallest representable number greater than 1, a single bit difference in the least significant (smallest change) bit.
The difference between 1 and 1+eps(1), which is to say eps(1), is the 2.22E-16 that you noted above.
This eps() value scales in linear jumps, so eps(2) is 2*eps(1), eps(16) is 16*eps(1), eps(1/16) is eps(1)/16 .
It is not a number of decimal places; it is _relative_ tolerance. eps(1/1024) is eps(1)/1024 so if you were working with base values in the approximate range of 0.001 then you would not still be limited to 2E-16 accuracy; you would be limited to about (2E-16)/1000 accuracy. And likewise, if you are working with values in the range of 1000, you do not get 1000 + 2E-16 accuracy, you get about 1000 + 1000*2E-16 = 1000 + 2E-13 accuracy
Now, there are also all kinds of rounding reasons and limits on accuracy of special functions like sin(), that can result in worse accuracy; eps() gives best-case accuracy.
Richard
on 18 Jan 2012
Categories
Find more on Logical in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!