posted 17 years ago
Howdy cowboys,
it does not matter how many bits they have.
It only matters here, how big the numbers can be.
And any long number is low enough to fit into a float, so there is no double needed. But I admit, the double would be more precise.
prints
long: 9223372036854775807
same: 9.223372E18
same2: 9.223372036854776E18
float: 3.4028235E38
The value of the highest possible long can easily be represented in a float. And even if you stored the long into a double you would lose some precission, because the double cannot store all the digits of the long (lost in bold above), it needs some bits for the exponent.
But you could argue, that for the sake(*) of precission, it would have been better to put the floats into a double automatically. I guess this hasn't been done to save system resources. But this is only my guess, I don't know really.
Yours,
Bu.
------------------
(*) = japanese rice wine