Thursday 6 March 2014

I am a new Computer Science student. Please tell me how you got to your conclusion so I can learn from it. I want to have an in depth understanding...

The advantage of a large memory cell is that you can store much larger numbers (and all data is, ultimately, numbers) in one cell, which generally improves the speed and reliability of data access.

The disadvantage is that you use up a larger portion of whatever data storage medium you are using on each word of data, and as a result can store less data overall.

You can think of it as sort of like carrying fruit in baskets, but with a rule that you're only allowed to put one fruit in each basket. If you have really large baskets, you can carry really big fruit in each one, but fewer fruit overall. So the optimal basket size will depend on whether you're carrying cherries or watermelons. For cherries you want lots of tiny baskets; for watermelons, you want a handful of huge baskets.

Using sign/magnitude notation, the largest 64-bit integers are +-2^63, which is 9,223,372,036,854,775,808.

That's... a really huge number. If you can find a way to encode a lot of data in individual numbers, this 64-bit integer might make sense. Otherwise, you're using 64 bits to store each number when you probably could have done with 8 or 16.

The largest 8-bit integers would be only +-2^7, which is 128. It's not hard to see why that might not be enough. But go up to 16-bit and you can already get as high as +-2^15, which is 32,768. YouTube appears to use unsigned 32-bit integers, because they once had a video get so many views that it had an overflow at 2^32, which is 4,294,967,296. (That's just about 4.3 billion; the world population is about 7.3 billion.)

If you store long ints that take up two 64-bit cells, you can go even bigger, and store signed integers as large as +-2^127, which is the even more ridiculous number 170,141,183,460,469,231,731,687,303,715,884,105,728. I can't think of a lot of situations where you'd actually need to go that large.

Remember that if you have huge numbers you can always switch to floating point and store numbers like 4.237428241e974; this particular example still only takes up 32 bits for the mantissa and 10 for the exponent. You lose precision that way, but how often do you need both hundreds of digits and perfect precision?

No comments:

Post a Comment

Is there any personification in "The Tell-Tale Heart"?

Personification is a literary device in which the author attributes human characteristics and features to inanimate objects, ideas, or anima...