Confused with size of long and double
Looking at Java (but probably similar or the same in other languages), a
long and a double both use 8 bytes to store a value.
A long uses 8 bytes to store long integers from -9,223,372,036,854,775,808
to 9,223,372,036,854,775,807
A double uses 8 bytes to store double-precision, floating-point numbers
from -1.7E308 to 1.7E308 with up to 16 significant digits.
My question is, if both use the same number of bytes (8 bytes or 2^64),
how can double store a much longer number? 1.7E308 is a hell of a lot
larger than 9,223,372,036,854,775,807.
No comments:
Post a Comment