Number Systems & Encoding Scheme
Topics are covered in this post :
- Number system:
- Binary, Octal, Decimal and Hexadecimal number system
- Conversion between number systems.
- Encoding schemes:
- ASCII, ISCII and UNICODE (UTF8, UTF32)
Number Systems
A number system is a method to represent (write) numbers. Every number system has a set of unique characters or literals. The count of these literals is called the radix or base of the number system.
Number systems are also called positional number system because the value of each symbol, i.e. digit or alphabet, depends upon its position within the number.
Number may also have a fractional part similar to decimal numbers used by us.
The symbol at the right most position in the integer part in a given number has position 0. The value of position (also called position value) in the integer part increases from right to left by 1.
On the other hand, the first symbol in the fraction part of the number has position number –1, which decreases by 1 while reading fraction part from left to right.
For Examples
5 | 6 | 8 | . | 9 | 2 |
2 | 1 | 0 | . | -1 | -2 |
5 x 102 | 6 x 101 | 8 x 100 | . | 9 x 10-1 | 2 x 10-2 |
Representation of Number in Decimal Systems
Types of Number Systems
The four different types of number systems are used in computer system. These are –
- Decimal Number Systems
- Binary Number Systems
- Octal Number Systems
- Hexadecimal Number Systems
Decimal Number Systems
The decimal number system is the most common number systems. It is known as base-10 Number system. It has 10 digits i.e. unique symbols (0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ).
For Examples : Number 568.92 represented as
5 | 6 | 8 | . | 9 | 2 |
2 | 1 | 0 | . | -1 | -2 |
5 x 102 | 6 x 101 | 8 x 100 | . | 9 x 10-1 | 2 x 10-2 |
500 | 60 | 8 | . | 0.9 | 0.02 |
Decimal Number Systems
Binary Number Systems
A number systems which has only two unique symbols (bi) 0 & 1, with base 2 , is called Binary Number Systems. For example 111001, 10011.111, 111001.1101.
Decimal Numbers | Binary Representation (4 – bits) |
0 | 0000 |
1 | 0001 |
2 | 0010 |
3 | 0011 |
4 | 0100 |
5 | 0101 |
6 | 0110 |
7 | 0111 |
8 | 1000 |
9 | 1001 |
Binary representation of Decimal Number digits (0 to 9)
Octal Number Systems
Octal number system is called base-8 system as it has total eight digits (0-7), and positional value is expressed in powers
of 8. Three binary digits i.e. 8 = 23 are sufficient to represent any octal number in binary number.
Example : (536)8 , (105)8
Why (943)8 is not a valid octal number?
Ans: In 943, 9 is not a valid octal number digit. Only 0,1,2,3,4,5,6 & 7 are the valid octal digits use to represent any octal number.
Why Octal Number System?
When you represent a large decimal number, binary numbers becomes so large and it is difficult to manage. So that Octal number system was developed. Octal number system is a compact representation of the binary numbers.
Octal Digit | Binary Representation (3 – bits) |
0 | 000 |
1 | 001 |
2 | 010 |
3 | 011 |
4 | 100 |
5 | 101 |
6 | 110 |
7 | 111 |
Binary representation of Octal digits (0 to 7)
Hexadecimal Number Systems
Hexadecimal number systems is consists of 16 unique symbols (0 – 9, A–F), and is called base- 16 system. In Hexadecimal number system Note here that the decimal numbers 10 through 15 are represented by the letters A through F.
Hexadecimal numbers are also used for compact representation of binary numbers.
In hexadecimal system, each alphanumeric digit is represented as a group of 4 binary digits because 4 bits (16 = 24) are sufficient to represent 16 alphanumeric symbols.
Examples of Hexadecimal numbers are (23A.05)16, (1C3)16, (619B.A)16
Representation of Decimal, Hexadecimal, Octal , and Binary
Decimal Number | Hexadecimal Symbol | Octal Representation | Binary Representation (4 – bits) |
0 | 0 | 0 | 0000 |
1 | 1 | 1 | 0001 |
2 | 2 | 2 | 0010 |
3 | 3 | 3 | 0011 |
4 | 4 | 4 | 0100 |
5 | 5 | 5 | 0101 |
6 | 6 | 6 | 0110 |
7 | 7 | 7 | 0111 |
8 | 8 | 10 | 1000 |
9 | 9 | 11 | 1001 |
10 | A | 12 | 1010 |
11 | B | 13 | 1011 |
12 | C | 14 | 1100 |
13 | D | 15 | 1101 |
14 | E | 16 | 1110 |
15 | F | 17 | 1111 |
Decimal -> Hexadecimal -> Octal -> Binary Representation
Conversion between Number Systems
Converting a number from one Base to another
Conversion from decimal number system to Other number system
To convert a decimal number to other number system, repeated division method is used.
Decimal to Binary conversion:
To convert a decimal number to binary number, repeated division method is used.
Repeatedly divide the decimal number with base 2, record all remainders in reverse order.
Example:
Convert (150)10 to Binary Number
Base | Number | Remainder | |
2 | 37 | 1 | LSB (Least Significant Bit) |
2 | 18 | 0 | ^ |
2 | 9 | 1 | | |
2 | 4 | 0 | | |
2 | 2 | 0 | | |
2 | 1 | 1 | MSB (Most Significant Bit) |
0 |
(150)10 =(100101)2
Answer : (150)10 =(100101)2
Decimal to Octal conversion:
To convert a decimal number to octal number, repeated division method can be used.
Repeatedly divide the decimal number with base 8, record all remainders in reverse order.
Example:
Convert (150)10 to Octal
Base | Number | Remainder | |
8 | 150 | 6 | LSB (Least Significant Bit) |
8 | 18 | 2 | ^ |
8 | 2 | 1 | MSB (Most Significant Bit) |
0 |
(150)10 =(126)8
Answer : (150)10 =(226)8
Decimal to Hexadecimal conversion
To convert a decimal number to Hexadecimal number, we can do repeated division method is used.
Repeatedly divide the decimal number with base 16, record all remainders in reverse order.
Example:
Convert (170)10 to Hexadecimal
Base | Number | Remainder | |
16 | 165 | 5 | LSB (Least Significant Bit) |
16 | 10 | 10 -> A | ^ MSB (Most Significant Bit) |
0 |
(165)10 =(A5)16
Answer : (165)10 =(A5)16
Converting Binary, Octal and Hexadecimal Numbers to Decimal Number
Converting Binary to Decimal number
Start from the rightmost bit. Multiply each bit by its positional value and then take the sum.
Example:-
Convert the Binary number 11011 to its Decimal equivalent.
1 x 24 + 1 x 23 + 0 x 22 + 1 x 21 + 1 * 20
16 + 8 + 0 + 2 + 1 = (27)10
Converting Octal number to Decimal number
Start from the rightmost bit. Multiply each bit by its positional value and then take the sum.
Example
Convert the Octal number 341 to its Decimal equivalent.
= 3 x 82 + 4 x 81 + 1 x 80
= 192 + 32 + 1
= (225)10
Converting Hexadecimal number to Decimal number
Start from the rightmost bit. Multiply each bit by its positional value and then take the sum.
Example
Convert the Hexadecimal number (21A)16 to its Decimal equivalent.
21A
= 2 x 162 + 1 x 161 + A x 160
= 2 x 162 + 1 x 161 + 10 * 160
= 512 + 16 + 10
= (538)10
Arithmetic Operation with Binary Numbers:
Binary Addition
Computers work with binary numbers 0 and 1. They understand only binary numbers.
There are 5 basic cases for binary addition. These are :-
- 0+0 = 0
- 0+1 = 1
- 1+0 = 1
- 1+1 = 10
i.e , binary 1+ binary 1 equals 0 with a carry 1
- 1+1+1 = 11
i.e, binary 1 + binary 1 equals 1 with a carry 1
Encoding Scheme
Character / String Representation :
A computer can handle numeric and non numeric data like letters, punctuation marks and other special characters. Some predefined codes are used to represent numeric and non numeric characters.
Standards encoding schemes are :-
ASCII
ASCII stands for American Standard Code for Information Interchange. ASCII-7 is a 7-bit code and can represent 128 characters. Out of 7 bits, 3 are zone bits and 4 are numeric bits.
ASCII-8 can represent 256 characters. It is an extended form of ASCII-7.
ISCII: (Indian Standard Code for Information Interchange)
A lot of efforts have done to facilitate the use of Indian languages on computers. In 1991, the Bureau of Indian Standards adopted the ISCII. It is an 8 bit code which allows English and Indian Scripts alphabets to be used simultaneously. Characters coded in ISCII need 8 bits for each character.
Unicode
Unicode is a new universal coding standard adopted by all new platforms. It is promoted by Unicode Consortium which is a non profit organization. Unicode provides a unique number for every character irrespective of the platform, program and the language. It is a character coding system designed to support the worldwide interchange, processing, and display of the written texts of the diverse languages.
Discover more from EduGrown School
Subscribe to get the latest posts sent to your email.