Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is a numerical computing question: Let F be the set of all IEEE double-prec

ID: 667322 • Letter: T

Question

This is a numerical computing question:

Let F be the set of all IEEE double-precision floating-point numbers, except NaNs and Infs, which have biased exponent 7ff (hex), and denormals, which have biased exponent 000 (hex).

(a) How many elements are there in F?

(b) What fraction of the elements of F are in the interval 1 x < 2?

(c) What fraction of the elements of F are in the interval 1/64 x < 1/32?

(d) Determine by random sampling approximately what fraction of the elements x of F satisfy the Matlab logical relation

Any suggestions?

Explanation / Answer

The 64-bit pattern has 1 sign bit, 11 exponent bits, and 52 mantissa bits.

All of the possible 64-bit patterns are in the IEEE floating point model, so there are 2^64 different bit patterns in the model. Now lets throw out the NaN and Inf and denormalized.

For NaN and Inf, the exponent is always all bits set, or leading bits of 7ff. So 11 bits have to be set to this, and the other 1 + 52 = 53 bits can be set to anything.

The total number of bit patterns for this is then 2^53. For the denormalized, the exponent has to be 000, so again the total number of denormalized is (almost) 2^53.

The reason I say almost is that the two bit patterns for +0 and -0 are not strictly part of the denormlized set. So, the total number of floating point bit patterns in IEEE double excluding NaN and Inf and denormalized is:

    2^64 - 2^53 - 2^53 + 2

To get the same answer with MATLAB, one could do this:

>> ieeemax = typecast(realmax,'int64')
ieeemax =
  9218868437227405311
>> ieeemin = typecast(realmin,'int64')
ieeemin =
     4503599627370496
>> 2*(double(ieeemax)-double(ieeemin))
ans =
    1.842872967520007e+019
>> 2^64 - 2^53 - 2^53 + 2
ans =
    1.842872967520007e+019

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote