Unknown x: x+1=1 in machine numbers

4 views (last 30 days)
JIM
JIM on 2 Nov 2012
How do I set unknown variable x to find the largest x for which x + 1 = 1 in Matlab?
  2 Comments
JIM
JIM on 2 Nov 2012
Yeah but if I want the smaller x for whick x=x+1? Is the same? And the largest x is the eps(y) for every y for which x+y=y?
Thank you for your answer!

Sign in to comment.

Answers (1)

Matt Fig
Matt Fig on 2 Nov 2012
x = eps(1)/2;
If x is larger than this, 1+x>1.
  11 Comments
JIM
JIM on 2 Nov 2012
I mean the largest number x that recognized by "my" computer for which x+5000=x (so the x is a very small number and I try to find this small number)
Matt Fig
Matt Fig on 3 Nov 2012
Like I said, you will get close with the code I gave you above, then you can zoom in by looking at smaller differences than x/2. Is this homework?

Sign in to comment.

Categories

Find more on Mathematics in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!