HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Data types for storing arbitrarily much information

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
arbitrarilymuchstoringfortypesdatainformation

Problem

I've heard that YouTube had a problem with the view count on Gangnam style since the number of views exceeded the variable byte size.

What's the problem with creating really large variables? Why does it end with unsigned long, for example? Can you create bigger and bigger variables to hold more and more bytes? Is there any reason why programmers don't just use a really big variable for everything?

Solution

Yes, you can create bigger and bigger variables to store big integer. There are many libraries that provide that functionality. For example BigInteger in Java. The problem with using big integer is that it makes program slower as more instructions are required to perform operations such as addition. Moreover, using a bigger representation will consumes more memory.

Context

StackExchange Computer Science Q#45353, answer score: 6

Revisions (0)

No revisions yet.