Imagine turning your PC on to play your favourite video game. The vibrant graphics, the thrilling gameplay, maybe combats with in-depth stats, your health/stamina bar, maybe calculated jumpscares that make you have a heart attack, and the overall immersive world. This all seems to come alive at your fingertips. But behind the scenes, there’s a hidden sequence of letters and numbers making this possible , and at its roots the language that makes all of this is binary numbers. Just like the magical spells in a fantasy realm or the tutorial scene that you key mashed to skip, yet do not understand the gameplay without, binary is the foundation that powers every aspect of modern computing.
Binary numbers are the simple yet powerful way computers understand and process information. With only two digits 0 and 1 this base-2 system enables everything from the pixelated graphics on your screen to the complex algorithms that drive artificial intelligence. Just as a your character’s abilities are represented by a series of attributes, every piece of data in a computer is ultimately translated into binary.
Please, “Press any button to continue”, to explore the fascinating world of binary numbers, find out the basics, and learn how to perform arithmetic operations that can unlock some secrets. Whether you’re calculating scores, creating character animations, or managing game states, binary numbers are the unpaid workers backstage, that I think should be more appreciated and known (>﹏<).
So what Are Binary Numbers?
Binary numbers are a way of representing numbers using only two digits: 0 and 1. This is different from the decimal system, which uses ten digits (0-9). Computers operate using electrical signals that can be either on (1) or off (0). With just two states of electricity, we can represent important information. We call this representation Binary ー which literally means “of two states”, like bilingual meaning speaking two languages. The “on” state, when electricity is flowing, represents true, whereas the off state, when no electricity is flowing, represents false.
Understanding Binary and bases
Binary is a base-2 number system. Each position in a binary number represents a power of 2, just like each position in a decimal number represents a power of 10.
For example, the binary number 1011 can be presented as:
1011 = 1*2^3 + 0*2^2 + 1*2^1 + 1*2^0
So, 1011 in binary equals 8+0+2+1=11 in decimal.
This is actually how you convert binary to decimal(base 10). One curious fact, ancient nations like Sumerians and Babylonians used base 12 (duodecimal) instead of base 10 ! But still it is more common nowadays to use base 10 , since even counting we use our digits( aka fingers), which are usually 10 (emphasis on usually, there are exceptions (‾◡◝)
Decimal to Binary conversion can be done this way: divide the decimal number by 2 and record the remainder. Repeat with the quotient until it’s 0. The binary equivalent is the remainders read in reverse.
Example: 13 to binary:
13 ÷ 2 = 6 (remainder 1)
6 ÷ 2 = 3 (remainder 0)
3 ÷ 2 = 1 (remainder 1)
1 ÷ 2 = 0 (remainder 1)
From bottom to top we get 1101.
Now, onto arithmetic operations in binary.
- Binary Addition
Binary addition follows similar rules as decimal addition, where here we carry over when we reach 2 (since binary has only 0 and 1).
Rules:
0+0=0
0+1=1
1+0=1
1+1=10 (which means you write down 0 and carry 1 to the next higher bit)
Example: 101 (5 in decimal) + 011 (3 in decimal):
( 1 1 1 (carries)) 1 0 1 + 0 1 1 ------ 1 0 0 0 (8 in decimal)
- Binary Subtraction
Binary subtraction is similar to decimal subtraction, and we might need to borrow from the next column if we have to subtract a larger digit from a smaller one.
Rules:
0−0=0
1−0=1
1−1=0
0−1 requires borrowing from the next higher bit.
- Binary Multiplication
Binary multiplication works much like decimal multiplication, but you only multiply by 0 or 1.
0×0=0
0×1=0
1×0=0
1×1=1
Example: Multiplying 101 (5 in decimal) by 011 (3 in decimal):
101 x 011 --------- 101 (this is 101 * 1) 000 (this is 101 * 0, shifted one position left) + 101 (this is 101 * 1, shifted two positions left) --------- 1111 (15 in decimal)
There is still so much more to explore in the realm of binary numbers, which I hope to share with y’all soon! (✿◡‿◡)
P.S Please share opinions, any feedback is greatly appreciated(❁´◡`❁)
Discover more from Coursity
Subscribe to get the latest posts sent to your email.