MATLAB: Uniform distribution of floating point numbers in double arithmetics.

double arithemetics

I need to show that in double arithmetics, according to IEEE standard, floating point numbers are uniformly distributed in set [1,2] with an interval of 2^-52.
In other words, any floating point number x can be shown as: x = 1 + k * epsilon. where: epsilon = 2^-52.
I have no clue how to do this, is generating random numbers from given set a good start? Is there any way to generate all of the numbers from a given set?

Best Answer

First look up the floating point bit pattern, which you can find here:
Then note that all the numbers between 1 and 2, not including 2 itself, have the same exact exponent bit pattern in IEEE format. The only thing that varies is the mantissa. Since the mantissa bits take on all possible values and since the exponent is the same for all of those values, it follows that the resulting set is "uniformly" distributed. That is, the set of numbers forms a fixed spaced set of numbers on a number line. The number 2 itself, although using a different exponent value, happens to be the same delta away from the next highest number in the set as the other numbers, so the complete set of numbers in [1,2] inclusive is a fixed space set of numbers (i.e., "uniform").
As to the interval delta, just look at the value of the least significant bit.