DEV Community

Cover image for Just a Little Bit
Summer Rizzo
Summer Rizzo

Posted on

Just a Little Bit

There's a mighty high chance that most folks who have used a computer have heard of the "bit." It comes up a lot in quantizing - 8-bit music, 16-bit games, 32- or 64-bit processors, and so on. Those are all different objects that n-bit is a modifier of, but they do have one unifying base - and that's the computer.

So, what is a bit? What does it mean when something is 8, 16, 24, 32 or 64 "-bit"? And why are they all in multiples of 8?

I've always enjoyed the phrase "It's all a bunch of 1's and 0's" in reference to computing. Perhaps it's a little existentialist, but it's the meaning we apply to those 1's and 0's, right? Stay with me here. As a simple definition, a bit is a binary digit. Its value is either a 1 or a 0 and it's the smallest unit of measurement in computers. We group together bits in packs of 8. This is called a byte. There are other larger groupings you're probably familiar with - for instance, Kilobytes (1,024 bytes), Megabytes (1,024 KBs), Gigabytes (1,024 MBs) and so on. Those are often used to refer to the size, or the amount of information, that a file stores.

Although the concept of a binary digit is simple - it can only represent one of two things - they hold the potential to build some very complex systems. After all, they're the basic building block of computers! A byte can be used to store information such as a character or a number. Here's a simple example of binary representation of numbers:

0000 0001 // 1
0000 0010 // 2
0000 0011 // 3 (notice how it's a combination of 1 and 2? it's not a coincidence!)

The arithmetic looks a bit strange - but it works just like decimal numbers that we're used to seeing. The key difference is that it's in base-2 as opposed to base-10. Think about adding two numbers on paper - when one column sums to a number > 10, we "carry" the remainder over. Here, the limit is 2 instead of 10, which you can see at play above.

And those are just whole numbers! Binary can be used to represent all kinds of things - take a look into how floating point numbers are represented in binary. This is really useful for computer hardware, but obviously a little harder for us humans. There are other ways to represent information - like hexadecimal representation, for instance.

At this point, we understand that bits are a way to store information. If the computer you're reading this on is any indication, the complexity and potential of how that information is used scales to some pretty impressive depths. The nitty gritty of that is met with the same complexity - a lot of it deals with heavy topics such as computer architecture and electrical engineering. But, let's take a peak into how bit processing plays a part in the potential power of our computers.

At the beginning of this blog, I touched on how a computer's processing power can be referred to as n-bit. That refers to the register size in that computer's memory. Moreover, a computer's bit size refers to how many bits the CPU can access from memory at a time - a 16-bit computer can process 2 bytes at once, for instance. This is often referred to as the processor's word size. As we know from above, bits are used to store pieces of data. With that in mind, you might see why an 8-bit video game on NES looks and feels quite a bit different than a game on a 64-bit Nintendo Switch (made up of 8 64-bit processors in the CPU, along with a GPU).

Amount of bits matters a bit less than it did when they were more expensive. You might notice, for instance, that the "64" in N-64 refers to bits. Let's use ints as an example of how data scales with the word size of a processor. A byte can represent unique values from 0-255. 2 bytes, or 16-bits, can represent up to 65,535. And, for 64-bit - 18,446,744,073,709,551,616. That's a pretty big number! At this point, it's more pertinent to have more processors (multicore) than it is to have a bigger word size.

A bit may be simple, but just a little bit can contribute to a bunch of power.

Further reading:

Discussion (4)

Collapse
rizz0s profile image
Summer Rizzo Author

Now you're getting it! ;P

Collapse
birdo profile image
Birdo • Edited

Aw, you can never compete with my 1111 1111 friends! (repesented in one's complement of course) :)

Anyway, great introduction into the binary system :)!