From: Sarah Jones on
Hi All,
Please help on the following problem.
What is the largest integer N, for which all the integers in the interval [-N, N] are "exactly" representable in IEEE double precision form?

Thank you
Sarah
From: Rune Allnor on
On 27 Jan, 04:59, "Sarah Jones" <JSarahJone...(a)gmail.com> wrote:
> Hi All,
> Please help on the following problem.
> What is the largest integer N, for which all the integers in the interval [-N, N] are "exactly" representable in IEEE double precision form?

Homework?

First find the largest possible exponent. The number you
find should tell you something about the number of bits
in integer fraction of the answer. Then compare his number
of bits to the number of bits in the mantissa and the number
of multiplications indicated by the exponent. Check if any
decimal bits remain after the multiplications. If not, the
answer ought to be easy to find.

Or something like that.

Rune
From: James Tursa on
"Sarah Jones" <JSarahJones85(a)gmail.com> wrote in message <hjodm8$qn1$1(a)fred.mathworks.com>...
> Hi All,
> Please help on the following problem.
> What is the largest integer N, for which all the integers in the interval [-N, N] are "exactly" representable in IEEE double precision form?
>
> Thank you
> Sarah

We seem to be getting a lot of IEEE homework questions lately. Are you all in the same class?

To answer this question, think of the mantissa bits as one big integer with the very last bit the 1's bit. How big would the exponent have to be to get this to happen? That will get you close to the answer. You could also use the vpi and num2strexact submissions in the FEX to help you test your answer. They can be found here:

http://www.mathworks.com/matlabcentral/fileexchange/22725-variable-precision-integer-arithmetic

http://www.mathworks.com/matlabcentral/fileexchange/22239-num2strexact-exact-version-of-num2str

James Tursa