Dmitry Timoshkov [mailto:[EMAIL PROTECTED] wrote:

>"Vitaly Budovski" <[EMAIL PROTECTED]> wrote:
>
>> Please show me how an unsigned int can represent values greater than 
>> 2^32. This is why a float is used.
>
>Of course int can't, but neither float can. Perhaps you confuse it with
double?

I think float can represent integers larger than 2^32 but it will be not
anymore
fully accurate. In fact it will start getting inaccurate in representing
every
possible integer at around 2^22. But that does not mean that it can't
represent
2^40 approximately. The maximum decimal range of a float is around +-4 * 10
^ 38
compared to 4 * 10 ^ 9 for an unsigned 32 bit integer.

So if full integer accuracy is not a concern, which I think isn't in this
case,
floats definitely have a range advantage over 32 bit integers. Even 64 bit
integers can't cover that range although they might have a large enough
range
for this problem.

Rolf Kalbermatter




Reply via email to