Software engineer in the making week 1.0.. Understanding Number System.
Hi there and welcome to my blog.. here i share my Journey becoming a software engineer.
A little recap on my former post :
I wrote about Basic computer software.. Knowing your Computer , a pretty short read but an eye opener thanks to Prash our beloved Teacher He calls it System Doctrine.. next was about the know about getting your computer connected to the internet..
Today it is about number system.
Number systems form the basis of digital logic, data representation, algorithms, and cryptography, empowering us to build the technology-driven world we live in today.
Number systems is a representation of numbers in different bases.
The most commonly number system is the decimal system, also known as base 10, which uses ten digits (0-9) and powers of 10 to represent values. We also have the Binary System (Base 2): It operates on a base 2 and employs only two digits, 0 and 1. Binary digits, or bits, Binary serves as the building blocks of digital information storage and processing. Hexadecimal, or hex, is another number system It operates on a base 16 and employs digits from 0 to 9 along with letters A to F to represent values greater than 9. The octal system or base 8 number system represents digits from 0 to 7.
Lets do a simple recap of the first computer that was invented
Ancient Era (200 BC - 70 BC): The Antikythera mechanism, a complex mechanical device used for astronomical calculations, is a contender. Mechanical Age (1822 - 1871): Charles Babbage's Analytical Engine, designed but never built, laid the groundwork for modern computers with its programmability and memory. Electronic Era (1942): The Atanasoff-Berry Computer (ABC) is often credited as the first truly electronic digital computer. So, depending on your definition, the "first computer" could be from ancient Greece, mid-19th century England, or 1940s America!
For me understanding number system helps bridge the gap of what the computer interprets and executes of instructions we give it, how it stores and grades items , and this understanding translates to building flexible software's` ...
A Little Break down
Count 1 2 3 4 5 6 7 8 9.. You Just counted decimals.
A question!! Do computers Interpret 1 2 3 4 5 6 7 8 9.. as 1 2 3 4 5 6 7 8 9.. ?
Well no as you read on you will understands how the computer interprets 1 2 3 4 5 6 7 8 9..
Binary Number System: Computers operate on the binary system, using only two digits, 0 and 1, these digits represent electrical states: 0 for "off" and 1 for "on." Everything we do with computers, from typing text to watching videos, is ultimately processed as binary code.
Now we know about Binary Number system...
here are some ways our computers interprets 1 2 3 4 5 6 7 8 9.. in decimal so as to execute commands.
Encoding and Decoding translating our language (text, numbers, images, sounds) into binary code the computer understands. Decoding: Converting binary code back into a human-readable format.
Data Representation: Numbers: Represented in binary using positional notation (base 2). Text: Each character is assigned a unique binary code (e.g., ASCII). Images: Broken down into pixels, each with a binary color value. Sounds: Converted into digital waveforms represented by binary numbers.
Instructions and Execution: Programs are sets of instructions written in code (often high-level languages like Python or Java). These instructions are translated into machine code (binary) the computer can directly execute. The central processing unit (CPU) fetches, decodes, and executes these instructions sequentially.
with this understanding Lets talk about ASCII
ASCII: ASCII is an encoding standard that was widely used in early computer systems. It uses 7 bits (later extended to 8 bits) to represent a total of 128 (or 256) characters, including alphanumeric characters, punctuation marks, control characters, and special symbols. Each character is assigned a unique numeric code ranging from 0 to 127 (or 0 to 255 in extended ASCII). For example, the letter 'A' is represented by the ASCII code 65, 'a' is represented by 97, and the exclamation mark '!' is represented by 33.
ASCII Table
Do you know that Humans can also convert From Decimal to Binary and Vice Versa to deferent base .`
The general method to convert a number from any base to base 10 (decimal) and vice versa involves the use of the positional notation system.
Converting from any base to base 10 (Decimal): To convert a number from a given base to base 10, you multiply each digit of the number by the corresponding power of the base and sum up the results.
Let's take an example of converting a number from base b to base 10:
Start from the rightmost digit of the number.
Multiply the rightmost digit by b^0 (which is 1), the next digit by b^1, the next by b^2, and so on, increasing the power of b by 1 for each subsequent digit.
Sum up the results of these multiplications.
For example, to convert the number 1101 from base 2 (binary) to base 10:
1 2^0 + 0 2^1 + 1 2^2 + 1 2^3 = 1 + 0 + 4 + 8 = 13 Thus, 1101₂ = 13₁₀
.
Converting from base 10 (Decimal) to any base: To convert a number from base 10 to a desired base, you repeatedly divide the decimal number by the base and note down the remainders in reverse order until the quotient becomes zero.
For example, to convert the number 207 from base 10 to base 16 (hexadecimal):
Divide 207 by 16: quotient = 12, remainder = 15 (F in hexadecimal).
Divide 12 by 16: quotient = 0, remainder = 12 (C in hexadecimal).
The remainders in reverse order are FC. Thus, 207₁₀ = FC₁₆.
Read out this numbers +20 & -20, did you take note of the signs ??
+ and _
to be continued....