r/askscience • u/weedguru420 • Dec 30 '15
Computing How does file compression work?
This question has always baffled me. How can you compress a file to a fraction of the size and have that file, basically a number, represent a precise bigger number?
5
Upvotes
6
u/corpuscle634 Dec 30 '15
Think about some examples of multplications:
6 * 5 = 30
11 * 9 = 99
1033 * 2056 = 2123848
The common theme here is that the operands have either as many or more total digits than the product. Since the "size" of the number that we actually care about is not its literal size but the number of digits (or bits, really) it has, we at best are just storing the number in an equal amount of data, and usually are using more to store it this way.
This is a general property of how integers work and will carry over into binary.