Number System
A numeral system is a writing system for expressing numbers; that is, a mathematical notation for representing numbers of a given set, using digits or other symbol in a consistent manner.
For ‘r’ base or radix of a number system, then the numbers present in that number system are ranging from ‘0’ to ‘r-1’. The total numbers present in that number system is ‘r’. So, for various value of ‘r’ , we will get various number systems, as greater than or equal to two.
Mostly used number systems are:-
1) Decimal Number System
The decimal number system is also known as the base- 10 system, uses 10 digits ( 0-9) to represent numbers. The position of each digit in the decimal number system determines its value in the decimal system. The leftmost digit represents the largest power of 10, while the rightmost digit represents the smallest power of 10. The decimal point separates the integer part of the number from the fractional part. In this number system, the weight of integers part is successive position defined using the power as, 100, 101, 102 and so on.
Similarly, the successive positions to the right, the fraction part of the decimal point have weighs of 10-1, 10-2, 10-3 and so on. That means, each position has specific weight, which is power of base 10.
Example:
Let N= 34.5 be a decimal number. Integer part of this number is 34 and the fractional part is 0.5.
The weight of digits 3 and 4 will have weights of 101 and 100 respectively. Similarly, the digit 0.5 have weight 10-1 respectively.
Mathematically, this can be written as,
(34.5)10= 3* 101+ 4*100+5*10-1
2) Binary Number System
The binary number system is the foundation of digital electronics and computer science. In binary, there are only 2 symbols or digits used: 0 and 1. These two digits are used to represent the two states of binary digits called bits. Digital circuits and system use binary because it is easier to implement with the basic building blocks of digital electronics which have only two states: ON and OFF. With binary, it is possible to represent any number or information in a compact and efficient form, which makes it the ideal choice for digital systems. Since, the system uses only two different digits the base or radix of this number system is 2. The numbers in this system may possess both integer and fraction separated by dot (.) like in decimal number system. The part of the number, which lies to the left of the binary point is known as integer part and the part of number that lies to the right of the binary point is known as fractional part.
3) Octal Number System
The octal numeral system is the base-8 number system, and uses the digits 0 to 7. That means there are only 8 symbols or digits (0, 1, 2, 3, 4, 5, 6, 7) used to form other numbers. The main advantage of using the octal number system is that it uses fewer digits than the decimal and hexadecimal number system. So, it has fewer calculations and thereby less calculation errors.
4) Hexadecimal Number System
The hexadecimal number system is a type of number system, that has a base value equal to 16. It is also pronounced sometimes as ‘hex’. Hexadecimal numbers are represented by only 16 symbols. These symbols or values are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F. Each digit represents a decimal value. The list of 16 hexadecimal digits with their equivalent decimal, octal and binary representation is given here in the form of a table, which will help in number system conversion. This list can be used as a translator or converter also.
Converting from Decimal to other Number System
1) Decimal to Binary
Step 1: Divide the given decimal number by 2 and note down the remainder.
Step 2: Now, divide the obtained quotient by 2, and note the remainder again.
Step 3: Repeat the above steps until you get 0 as the quotient.
Step 4: Now, write the remainders in such a way that the last remainder is written first, followed by the rest in the reverse order.
Step 5: This can also be understood in another way which states that the Least Significant Bit (LSB) of the binary number is at the top and the Most Significant Bit (MSB) is at the bottom. This number is the binary value of the given decimal number.
Step 6: Read the remainders from down to up.
Now, Converted Decimal To binary
Example:
2) Decimal to Hexadecimal
Step 1: First, divide the decimal number by 16, considering the number as an integer.
Step 2: Keep aside the remainder.
Step 3: Again, divide the quotient by 16 and repeat till you get the quotient value equal to zero.
Step 4: Now take the values of the remainder’s left in the reverse order to get the hexadecimal numbers.
Example:
3) Decimal to Octal
Step 1: Write the given decimal number
Step 2: If the given decimal number is less than 8 the octal number is the same.
Step 3: If the decimal number is greater than 7 then divide the number by 8.
Step 4: Note the remainder, we get after division
Step 5: Repeat step 3 and 4 with the quotient till it is less than 8
Step 6: Now, write the remainders in reverse order (bottom to top)
Example:
Converting From Binary to Other Systems
1) Binary To Decimal
Step 1: First, write the given binary number and count the powers of 2 from right to left (powers starting from 0)
Step 2: Now, write each binary digit (right to left) with the corresponding powers of 2 from (right to left), such that first binary digit (MSB) will be multiplied with the greatest power of 2.
Step 3: Add all the products in the above step.
Step 4: The final answer will be the required decimal number.\
Example:
2) Binary To Octal
Step 1: Take the given binary number
Step 2: Multiply each digit by 2n-1 where n is the position of the digit from the decimal
Step 3: The resultant is the equivalent decimal number for the given binary number
Step 4: Divide the decimal number by 8
Step 5: Note the remainder
Step 6: Continue the above two steps with the quotient till the quotient is zero
Step 7: Write the remainder in the reverse order
Example:
3) Binary To Hexadecimal
Step 1: Note the required Binary Number
Step 2: Split the number in the group of four bits
Step 3: Write the decimal Form of the number divided in the groups
Step 4: Write the hexadecimal form of the numbers
Step 5: Hence, completed
Example:
Converting from Octal to Other Systems
1) Octal to Decimal
Step 1: Since an octal number only uses digits from 0 to 7, we first arrange the octal number with the power of 8.
Step 2: We evaluate all the power of 8 values such as 80 is 1, 81 is 8, etc., and write down the value of each octal number.
Step 3: Once the value is obtained, we multiply each number.
Step 4: Final step is to add the product of all the numbers to obtain the decimal number.
Now, Converted.
Example:
2) Octal to Binary
To convert octal to binary, firstly write down the octal number to be converted. Then, divide each octal digit. Now, convert each octal digit into binary form in the group of 3 bits. Combine the binary form of all octal digits. Now, successfully converted from octal to binary.
Example:
3) Octal to Hexadecimal
Step1: We first convert the octal number into binary. In order to convert an octal number to binary, we must write each octal digit’s 3-bit binary equivalent in the same order.
Step 2: Join the binary bits of all octal equivalent.
Step 3: Split the binary bits in the group of 4
Step 4: Write down hex equivalent of those groups
Now, Converted successfully
Example:
Step 1: Octal to Binary Conversion
So, the binary equivalent is 111101010
Step 2: Binary to Hex Conversion
Converting from Hexadecimal to Other Systems
1) Hexadecimal to Binary
Step 1: Take given hexadecimal number
Step 2: Find the number of digits in the decimal
Step 3: If it has n digits, multiply each digit with 16n-1 where the digit is in the nth position
Step 4: Add the terms after multiplication
Step 5: The result is the decimal number equivalent to the given hexadecimal number. Now we have to convert this decimal to binary number.
Step 6: Divide the decimal number with 2
Step 7: Note the remainder
Step 8: Do the above 2 steps for the quotient till the quotient is zero
Step 9: Write the remainders in the reverse order.
Step 10: The result is the required binary number.
Example:
2) Hexadecimal to Decimal
Step 1: Understand hexadecimal digits.
Step 2: Assign decimal values to each hexadecimal digit according to their positions.
Step 3: Multiply each digit by its corresponding power of 16.
Step 4: Convert hexadecimal letters to their decimal equivalents (A=10, B=11, C=12, D=13, E=14, F=15).
Step 5: Add up the results.
Example:
3) Hexadecimal to Octal
Step 1: Convert the given Hex number into Binary
Step 2: Group the binary bits of hexadecimal number
Step 3: Split the bits in the group of 3
Step 4: Write down the octal form of the separated bits group
Step 5: Hence, Converted.
Example:
1’s Complement Form
1’s complement of any number is obtained by flipping or inverting the digit or bits of binary number that is zero for 1 and 1 for zero. 1’s complement of positive number gives negative number and 1’s complement of negative number gives positive number.
Example:
2’s Complement Form
2’s complement form of any binary number is obtained by adding 1 in the LSB of 1’s complement form of that particular number.
Example:
Subtraction using 2’s complement
Steps: For subtracting smaller number
Step 1: Determine the 2’s complement of the smaller number
Step 2: Add this to the larger number.
Step 3: Omit the carry. Note that there is always a carry in this case.
Example:
Steps: For subtracting larger number
Step 1: Determine the 2’s complement of the smaller number.
Step 2: Add this to the larger number.
Step 3: There is no carry in this case. The result is in 2’s complement form and is negative.
Step 4: To get an answer in true form, take 2’s complement and change its sign.
Example:
Advantages of 2’s complement rather than 1’s complement
- i) Simplicity of Addition: In 2’s complement, addition of signed numbers can be performed using the same hardware as unsigned addition. This simplifies the arithmetic operations since there is no need to handle the special cases that arise in 1’s complement addition.
- ii) Unique Representation of Zero: In 2’s complement, there is only one representation for zero, whereas in 1’s complement there are two representations (positive zero and negative zero). This simplifies arithmetic and reduces the chance of errors due to inconsistencies in zero representation.
iii) No Sign Bit: In 2’s complement, the most significant bit (MSB) serves as the sign bit, simplifying comparisons and logical operations.
- iv) Easier Hardware Implementation: 2’s complement arithmetic can be implemented more efficiently in hardware, especially for subtraction operations, due to its simplified carry logic.
- v) Range of Representable Numbers: In 2’s complement, the range of representable numbers is symmetric around zero, which simplifies understanding and manipulation of numbers.