Can a real number "cover" all integers within its range?

Posted by macias on Stack Overflow See other posts from Stack Overflow or by macias
Published on 2012-09-15T21:21:12Z Indexed on 2012/09/15 21:38 UTC
Read the original article Hit count: 128

Filed under:

Is there a guarantee that a real number (float, double, etc) can "cover" all integers within its range?

By cover I mean, that for every integer within its range there is such real number that this equality holds:

real == int

Or in another example, let's say I have the biggest real number which is smaller than given integer.

When I add "epsilon" will I get this number equal to given integer or bigger than integer?

(I know that among real numbers you should not write comparisons as == for equality, I am simply asking for better understanding subject, not for coding comparisons.)

© Stack Overflow or respective owner

Related posts about math