Number System


 NUMBER SYSTEMS


The study of number systems is important from the viewpoint of understanding how data are represented before they can be processed by any digital system including a digital computer. It is one of the most basic topics in digital electronics. In this chapter we will discuss different number systems commonly used to represent data. We will begin the discussion with the decimal number system. Although it is not important from the viewpoint of digital electronics, a brief outline of this will be given to explain some of the underlying concepts used in other number systems. This will then be followed by the more commonly used number systems such as the binary, octal and hexadecimal number systems.
There are several number systems which we normally use, such as decimal, binary, octal, hexadecimal, etc. Amongst them we are most familiar with the decimal number system. These systems are classified according to the values of the base of the number system. The number system having the value of the base as 10 is called a decimal number system, whereas that with a base of 2 is called a binary number system. Likewise, the number systems having base 8 and 16 are called octal and hexadecimal number systems respectively.
With a decimal system we have 10 different digits, which are 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. But a binary system has only 2 different digits—0 and 1. Hence, a binary number cannot have any digit other than 0 or 1. So to deal with a binary number system is quite easier than a decimal system. Now, in a digital world, we can think in binary nature, e.g., a light can be either off or on. There is no state in between these two. So we generally use the binary system when we deal with the digital world. Here comes the utility of a binary
system. We can express everything in the world with the help of only two digits i.e., 0 and 1. For example, if we want to express 2510  in binary we may write 110012. The right most digit in a number system is called the ‘Least Signifi cant Bit’ (LSB) or ‘Least Signifi cant Digit’ (LSD). And the left most digit in a number system is called the ‘Most Signifi cant Bit’ (MSB) or ‘Most Signifi cant Digit’ (MSD). Now normally when we deal with different number systems we specify the base as the subscript to make it clear which number system is being used. In an octal number system there are 8 digits—0, 1, 2, 3, 4, 5, 6, and 7. Hence, any octal number cannot have any digit greater than 7. Similarly, a hexadecimal number system has 16 digits—0 to 9— and the rest of the six digits are specifi ed by letter symbols as A, B, C, D, E, and F. Here A, B, C, D, E, and F represent decimal 10, 11, 12, 13, 14, and 15 respectively. Octal and hexadecimal codes are useful to write assembly level language.
Binary Number System
Bit is an abbreviation of the term ‘binary digit’ and is the smallest unit of information. It is either ‘0’ or ‘1’. A byte is a string of eight bits. The byte is the basic unit of data operated upon as a single unit in computers. A computer word is again a string of bits whose size, called the ‘word length’ or ‘word size’, is fixed for a specified computer, although it may vary from computer to computer. The word length may equal one byte, two bytes, four bytes or be even larger.
Decimal Number System
Corresponding to the 1’s and 2’s complements in the binary system, in the decimal number system we have the 9’s and 10’s complements. The 9’s complement of a given decimal number is obtained by subtracting each digit from 9. For example, the 9’s complement of (2496)10 would be (7503)10. The 10’s complement is obtained by adding ‘1’ to the 9’s complement. The 10’s complement of (2496)10 is (7504)10.

Octal Number System
In the octal number system, we have the 7’s and 8’s complements. The 7’s complement of a given octal number is obtained by subtracting each octal digit from 7. For example, the 7’s complement of (562)8 would be (215)8. The 8’s complement is obtained by adding ‘1’ to the 7’s complement. The 8’s complement of (562)8 would be (216)8.
Hexadecimal Number System
The 15’s and 16’s complements are defined with respect to the hexadecimal number system. The 15’s complement is obtained by subtracting each hex digit from 15. For example, the 15’s complement of (3BF)16 would be (C40)16. The 16’s complement is obtained by adding ‘1’ to the 15’s complement. The 16’s complement of (2AE)16 would be (D52)16.
Number Representation in Binary System:


Sign-Bit Magnitude
In the sign-bit magnitude representation of positive and negative decimal numbers, the MSB represents the ‘sign’, with a ‘0’ denoting a plus sign and a ‘1’ denoting a minus sign. The remaining bits represent the magnitude. In eight-bit representation, while MSB represents the sign, the remaining seven bits represent the magnitude. For example, the eight-bit representation of +9 would be 00001001, and that for −9 would be 10001001. An n−bit binary representation can be used to represent decimal numbers in the range of
−(2n−1−1) to +(2n−1−1)
That is, eight-bit representation can be used to represent decimal numbers in the range from −127 to +127 using the sign-bit magnitude format.

1's Complement::
The ones' complement of a binary number is defined as the value obtained by inverting all the bits in the binary representation of the number (swapping 0's for 1's and vice-versa).A ones' complement system or ones' complement arithmetic is a system in which negative numbers are represented by the arithmetic negative of the value. In such a system, a number is negated (converted from positive to negative or vice versa) by computing its ones' complement. An N-bit ones' complement numeral system can only represent integers in the range              
−(2 N−1−1) to 2 N−1−1 
2’s Complement
The two's complement of a binary number is defined as the value obtained by subtracting the number from a large power of two (specifically, from 2N for an N-bit two's complement).A two's-complement system, or two's-complement arithmetic, is a system in which negative numbers are represented by the two's complement of the absolute value; this system is the most common method of representing signed integers on computers.In such a system, a number is negated (converted from positive to negative or vice versa) by computing its ones' complement (i.e. its bitwise negation) and adding one. two's complement can express
 −2 N−1 to 2 N−1−1.

0 comments:

Post a Comment