1
$\begingroup$

How can I calculate the machine epsilon for two numbers then calculate the theoretical limit for machine epsilon in Matlab ?

$\endgroup$
  • $\begingroup$ Could you perhaps define what you mean by "theoretical limit for machine epsilon" here? A limit is defined with respect to a variable tending to some (possibly infinite) value; what is tending where, here? $\endgroup$ – Patrick Sanan Sep 12 '14 at 10:24
2
$\begingroup$

So, machine epsilon is an upper bound on the relative error due to roundoff. You can calculate this quantity using the eps function:

 eps
        2.2204e-16

If you want to find the distance between a floating point number x and the next nearest floating point number, you would call eps(x) instead.

$\endgroup$
  • $\begingroup$ Right I get that but say I have the number 124 and 120 if I did eps (124) and esp(120) how would I calculate the theoretical limit for machine eps? $\endgroup$ – Rain Sep 7 '14 at 20:35
  • $\begingroup$ I don't understand what you're saying when you talk about "the theoretical limit for machine epsilon". That maximum relative error is eps, which is the limit of eps(x)/x as abs(x) approaches infinity; it's also eps(1). $\endgroup$ – Geoff Oxberry Sep 7 '14 at 20:44
  • $\begingroup$ Do you have any ideas what the theoretical limit for machine epsilon could mean? Because that is what my hw questions ask to find and I have no idea how to do that. $\endgroup$ – Rain Sep 8 '14 at 0:19
  • $\begingroup$ Each floating point representation has defined limits (including epsilon) based on the number of bits of exponent, mantissa, and how the signs are represented. Maybe you could give the exact form of the question. $\endgroup$ – Bill Barth Sep 8 '14 at 0:29
  • 2
    $\begingroup$ @Rain: You should a) put that information in the question, and b) clearly state that your question is a homework question, because it's site policy. $\endgroup$ – Geoff Oxberry Sep 8 '14 at 23:26

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.