# Number Systems & Encoding Scheme – Notes

### 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

Types of Number Systems

The four different types of number systems are used in computer system. These are –

1. Decimal Number Systems
2. Binary Number Systems
3. Octal 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

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.

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.

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

### 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

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

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:

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:

Computers work with binary numbers 0 and 1. They understand only binary numbers.
There are 5 basic cases for binary addition. These are :-

1. 0+0 = 0
2. 0+1 = 1
3. 1+0 = 1
4. 1+1 = 10

i.e , binary 1+ binary 1 equals 0 with a carry 1

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.