3 ms·
I appreciate the effort to write this up, but I'm not seeing that this has applicability to any real problem. If you put 53 random bits in the mantissa with a
by nkurz 12y ago
I appreciate the effort to write this up, but I'm not seeing that this has applicability to any real problem. If you put 53 random bits in the mantissa with a fixed exponent, you get a smooth distribution from from [0, 1 - 2^-53] in increments of 2^-53. He seems to be concerned that you will never get a number between(0, 2^-53). True, but you'll also never get any other number between (n * 2^-53,(n+1) * 2^-53) for all the rest of the range.
[wrong statement about denormals deleted]
His talk about "dividing" to produce the desired range seems misguided. Floating point division is ~10x the cost of any other floating point operations. If you are trying to produce precise floating point numbers, you almost certainly want to be working at the level of bits rather than hoping that division will do the work for you.
- dbaupp 12y agoNumbers less than 2^-53 aren't denormals. Denormals occur when the exponent is all zeros, i.e. less than 2^-1022, the floating point representation of a double (ignoring sign) is normally: 1.mantissa * 2^(exponent - 1023) A denormal occurs when the exponent is all zeros, and the representation switches to 0.mantissa * 2^(1 - 1023)
- nkurz 12y agoYou are completely right, and I just got lost. I deleted my nonsense above. Is there more to the main article that I'm missing too?
- chmike 12y agoThat's my understanding too. If we want a uniform distribution for the random numbers, we don't want numbers like 2^-100 to show up.