What is a Number System?

What is a Number System? 

A number system is a way of representing and manipulating numbers using a set of symbols and rules. Computers use different number systems to store and process data and the most commonly used number systems in computer science are, Binary (base 2), Octal (base 8), Decimal (base 10), and Hexadecimal (base 16). 

Common Number System:


System

Base

Symbols

Binary

2

0,1

Octal

8

0,1,2….7

Decimal

10

0,1,2,….9

Hexadecimal

16

0,1,2…,A,B,..F


Binary (base 2):-  The binary number system is used by computers because digital devices only understand and process two states - on or off, which can be represented by 0 and 1. Each digit in a binary number is called a bit. The value of a bit depends on its position within the number. For example, the binary number 1011 represents 11 in decimal.

The weights of the bits in a binary number are based on powers of 2. The rightmost bit has a weight of 2^0 (which equals 1), the next bit to the left has a weight of 2^1 (which equals 2), and so on. Each successive bit has a weight that is twice that of the previous bit.

For example, the binary number 1011 can be converted to decimal as follows:

1 x 2^3 + 0 x 2^2 + 1 x 2^1 + 1 x 2^0 = 8 + 0 + 2 + 1 = 11

Binary Number Representation:

2^n   (n = The weights of the bits in a binary number are based on powers of 2. )

2^2 = 4(no. of possibilities)      


Binary Table:

Decimal Number

Binary Number

0

 

00

1

01

2

10

3

11








Binary numbers are commonly used in computer programming to represent digital data such as text, images, and sound. In addition, Boolean logic operations (AND, OR, NOT, XOR) are performed using binary numbers.


Octal (base 8):- the octal number system is a base-8 numbering system. It uses the digits 0-7 to represent numbers. Octal numbers are often used in computer programming because they are a compact way of representing binary data.

Each digit in an octal number represents a combination of three binary digits (bits). For example, the octal number 27 can be converted to binary as follows:

2 -> 010

7 -> 111

= 010111

So, the octal number 27 is equivalent to the binary number 010111.

Octal numbers can also be converted to decimals by using the positional values of the digits. For example, the octal number 64 is equal to:

6 x 8^1 + 4 x 8^0 = 48 + 4 = 52 (decimal)

Similarly, the octal number 777 is equal to:

7 x 8^2 + 7 x 8^1 + 7 x 8^0 = 448 + 56 + 7 = 511 (decimal)

Octal Number Representation:

2^n   (n = The weights of the bits in an octal number are based on powers of 3 )

2^3 = 8(no. of possibilities)      


Octal Table:   

Decimal Number

Binary Number

0

000

1

001

2

010

3

011

4

100

5

101

6

110

7

111










In computer programming, octal numbers are often used to represent file permissions, where each digit represents the permissions for a different group (owner, group, others).


Decimal (base 10):- The decimal number system is the number system that we use in everyday life. It has ten digits (0-9), and each digit has a positional value based on its position within the number. For example, the decimal number 1234 represents the value 1 x 10^3 + 2 x 10^2 + 3 x 10^1 + 4 x 10^0 = 1234.

the decimal number system is not used as the primary number system. Instead, the binary number system is used, which is a base-2 number system.

Binary numbers are represented using only two symbols: 0 and 1. Each digit in a binary number is referred to as a bit, and a sequence of 8 bits is called a byte. In the binary system, each place value represents a power of 2 instead of a power of 10 as in the decimal system.

For example, the decimal number 7 is represented as 111 in binary. This is because 7 can be expressed as the sum of powers of 2 as follows: 2^2 + 2^1 + 2^0 = 4 + 2 + 1 = 7.

Similarly, the decimal number 255 is represented as 11111111 in binary, which is the maximum value that can be represented by an 8-bit byte.

When a computer needs to perform arithmetic operations using decimal numbers, it converts the decimal numbers into binary numbers first, performs the operation using binary arithmetic, and then converts the result back into decimal form if necessary.


Hexadecimal (base 16):- The hexadecimal number system uses 16 digits (0-9 and A-F) to represent numbers. Each hexadecimal digit corresponds to four bits in binary. Hexadecimal is often used in computer programming because it is easier to read and write than long binary numbers. For example, the hexadecimal number 3F8 represents the decimal number 1016.

In the hexadecimal system, each digit represents a power of 16. For example, the number 3B2 in hexadecimal represents:

3 * 16^2 + 11 * 16^1 + 2 * 16^0

= 3 * 256 + 11 * 16 + 2

= 754


Hexadecimal Number Representation:

2^n   (n = The weights of the bits in an octal number are based on powers of 4 )

2^4 = 16(no. of possibilities)  

    

Hexadecimal Table:           

Decimal Number

Hexadecimal  Number

0

0000

1

0001

2

0010

3

0011

4

0100

5

0101

6

0110

7

0111

8

1000

9

1001

A

1010

B

1011

C

1100

D

1101

E

1110

F

1111

Hexadecimal is commonly used in computer science and programming, as it provides a convenient way to represent binary numbers (which use a base of 2) in a more compact and readable format. Each digit in a hexadecimal number can represent four bits of binary, which is useful when working with computer memory and data storage.

No comments

Powered by Blogger.