Number Systems
Number Systems
MODULE 1
UNIT 1.1-Number Systems, Introduction – Base or radix, Non-positional and Positional number
system, Popular number systems (Decimal, Binary, Octal and Hexadecimal), Conversion-From
one number system to another, Concept of binary addition and subtraction, 1’s Complement,
2’s complement.
Number Systems
A number system (or numeral system) defines how a number can be represented using distinct
symbols. Each symbol in the number is called a digit. The leftmost digit in any number representation,
which has the greatest positional weight out of all the digits present in that number, is called the most
significant digit (MSD) and the rightmost digit, which has the least positional weight out of all the
digits present in that number, is called the least significant digit (LSD). A number can be
represented differently in different systems. The digits on the left side of the radix point form the
integer part of a number and those on the right side form the fractional part.
(𝑵)𝒓
=
Radix Point: Radix point is a base point used to separate the integer part and the fractional part of a
number.
1 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM
Positional number system is the type of number system in which the weight or value of the
digit (or symbol) depends upon its position in the number. The positional number system is
also known as weighted number system.
There are four very popular positional number systems, which are:
Base or radix: The number of symbols used in a number system is called base or radix of the
number system.
Eg: In decimal number system – Base is 10
In Binary number system – Base is 2
In Hexadecimal number system – Base is 16 etc
Most significant bit (MSB): The left most bit of a binary number which has the highest place
value is called most significant bit.
Least significant bit (LSB): The right most bit of a binary number which has the least place
value is called least significant bit.
Bit: A binary digit is called a bit. Example: 0 or 1
Nibble: A group of four bits is called a Nibble. Example: 0110, 1110 etc.
Byte: A group of eight bits is called a byte. Example: 01101101, 11010011 etc.
2 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM
3 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM
The decimal number system contains ten digits from 0 to 9(base 10). Here, the successive
place value or position, left to the decimal point holds units, tens, hundreds, thousands, and so on. The
position in the decimal number system specifies the power of the base (10). The 0 is the minimum
value of the digit, and 9 is the maximum value of the digit.
The decimal number can be an integer or floating-point integer. When the decimal number is a
floating-point integer, then we convert both part (integer and fractional) of the decimal number in the
isolated form (individually). There are the following steps that are used to convert the decimal
number into a similar number of any base ′𝒓’.
In the successive multiplication-by-2 method, the given decimal fraction and the subsequent
decimal fractions are successively multiplied by 2, till the fraction part of the product is 0 or till the
desired accuracy is obtained. The first integer obtained is the MSB. Thus, the integers read from top to
bottom give the equivalent binary fraction. To convert a mixed number to binary, convert the integer
and fraction parts separately to binary and then combine them.
For converting decimal to binary, there are two steps required to perform, which are as follows:
1. In the first step, we perform the division operation on the integer and the successive quotient
with the base of binary(2).
2. Next, we perform the multiplication on the integer and the successive quotient with the base of
binary(2).
4 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM
For converting decimal to octal, there are two steps required to perform, which are as follows:
1. In the first step, we perform the division operation on the integer and the successive quotient
with the base of octal (8).
5 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM
2. Next, we perform the multiplication on the integer and the successive quotient with the base of
octal (8).
(125)10 = (175)8
(0.513)10 =
(0.406517)8
∴ (𝟏𝟓𝟑. 𝟓𝟏𝟑)𝟏𝟎 = (𝟐𝟑𝟏. 𝟒𝟎𝟔𝟓𝟏𝟕)𝟖
For converting decimal to hexadecimal, there are two steps required to perform, which are as follows:
1. In the first step, we perform the division operation on the integer and the successive quotient
with the base of hexadecimal (16).
2. Next, we perform the multiplication on the integer and the successive quotient with the base of
hexadecimal (16).
6 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM
(2598)10 = (𝐴26)16
(0.513)10 = (0.9𝐸𝐵851)16
∴ (𝟗𝟓𝟐. 𝟔𝟐)𝟏𝟎 = (𝟑𝑩𝟖. 𝟗𝑬𝑩𝟖𝟓𝟏)𝟏𝟔
(10110)2 = 1 × 24 + 0 × 23 + 1 × 22 + 1 × 21 + 0 × 20
= 16 + 0 + 4 + 2 + 0
= 22
∴ (𝟏𝟎𝟏𝟏𝟎)𝟐 = (𝟐𝟐)𝟏𝟎
7 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM
Octal to Decimal
The process of converting octal to decimal is the same as binary to decimal. The process starts from
multiplying the digits of octal numbers with its corresponding positional weights. And lastly, we add
all those products.
Let's take an example to understand how the conversion is done from hexadecimal to decimal.
Hexadecimal to Decimal
The process of converting hexadecimal to decimal is the same as binary to decimal. The process starts
from multiplying the digits of hexadecimal numbers with its corresponding positional weights. And
lastly, we add all those products.
Let's take an example to understand how the conversion is done from hexadecimal to decimal.
8 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM
separates the integer and fraction parts. Each digit (bit) carries a weight based on its position relative
to the binary point.
A four-bit collection (1101) is known as a nibble, and a collection of eight bits (11001010) is known as
a byte. The location of a digit in a binary number represents a specific power of the base (2) of the
number system.
Characteristics:
Examples:
o Binary to Octal
As 8 = 23, for binary to octal conversion groups of 3 binary bits each are formed in the
binary number. After forming groups, each group of three binary bits is converted to its octal
equivalent.
- For integer part of the binary number, the group of three bits is formed from right to left. In
the binary fraction the group of three bits is formed from left to right. If there are not 3 bits available
at last, just stuff ‘0’ to make 3 bits group.
Binary to Hexadecimal
As 16 = 24, for binary to hexadecimal conversion groups of 4 binary bits each are formed in the binary
number. After forming groups, each group of four binary bits is converted to its hexadecimal
9 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM
equivalent.
For integer part of the binary number, the group of 4 bits is formed from right to left. In the
binary fraction the group of 4 bits is formed from left to right. If there are not 4 bits available at last,
The octal number system has base 8(means it has only eight digits from 0 to 7). There are only eight
possible digit values to represent a number. With the help of only three bits, an octal number is
represented. Each set of bits has a distinct value between 0 and 7
Characteristics:
Examples:
(273)8, (5644)8, (0.5365)8, (1123)8, (1223)8.
Octal to Hexadecimal
For converting octal to hexadecimal, there are two steps required to perform, which are as follows:
Eg:
10 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM
Example 1: (152.25)8
(152.25)8=(001101010.010101)2
Step 2:
1. Now, we make pairs of four bits on both sides of the binary point.
0 0110 1010.0101 01
On the left side of the binary point, the first pair has only one digit, and on the right side, the last pair
has only two-digit. To make them complete pairs of four bits, add zeros on extreme sides.
Octal to Binary
The process of converting octal to binary is the reverse process of binary to octal. We write the
three bits binary code of each octal number digit.
Example 1: (152.25)8
(152.25)8=(001101010.010101)2
11 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM
It is another technique to represent the number in the digital system called the hexadecimal number
system. The number system has a base of 16 means there are total 16 symbols(0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
A, B, C, D, E, F) used for representing a number. The single-bit representation of decimal values10, 11,
12, 13, 14, and 15 are represented by A, B, C, D, E, and F. Only 4 bits are required for representing a
number in a hexadecimal number. Each set of bits has a distinct value between 0 and 15. There are the
following characteristics of the octal number system:
Characteristics:
Hexadecimal to Octal
For converting hexadecimal to octal, there are two steps required to perform, which are as follows:
1. In the first step, we will find the binary equivalent of the hexadecimal number.
2. Next, we have to make the pairs of three bits on both sides of the binary point. If there will be
one or two bits left in a pair of three bits pair, we add the required number of zeros on extreme
sides and write the octal digits corresponding to each pair.
Example 1: (152A.25)16
Step 1:
12 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM
Step 2:
3. Then, we make pairs of three bits on both sides of the binary point.
(001010100101010.001001010)2=(12452.112)8
Hexadecimal to Binary
The process of converting hexadecimal to binary is the reverse process of binary to hexadecimal. We
write the four bits binary code of each hexadecimal number digit.
Example 1: (152A.25)16
Binary Arithmetic
Binary arithmetic includes the basic arithmetic operations of addition, subtraction, multiplication and
division
Binary Addition:
The binary number system uses only two digits 0 and 1 due to which their addition is simple. The
rules to perform binary addition are
0+0=0
0+1=1
1+0=1
1 + 1 = 0 with a carry 1
The above first three equations are very identical to the binary digit number. The column by column
addition of binary is applied below in details.
13 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM
1 + 1 = 10 = 0 with a carry of 1.
1 +1 +1 = 11
Binary Subtraction:
0–0=0
1–0=1
1–1=0
10 – 1 = 1
The above first three operations are easy to understand as they are identical to decimal subtraction.
The fourth operation can be understood with the logic two minus one is one.
14 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM
For a binary number with two or more digits, the subtraction is carried out column by column as in
decimal subtraction. Also, sometimes one has to borrow from the next higher column.
0–0=0
1–1=0
In the 2–3 column, a 1 cannot be subtracted from a 0. So, borrow a 1 from the 2–2 column
making the 2–2 column 0. The 1 borrowed from the 2–2 column becomes 10 in the 2–3 column
becomes 10 in the 2–3 column. Therefore, in the 2–3 column, 10 – 1 = 1.
In the 2–2 column, a 1 cannot be subtracted from a 0. So, borrow a 1 from the 2–1 column, but
it is also a 0. So, borrow a 1 from the 1’s column. That is also a 0, so borrow a 1 from the 2’s column
making the 2’s column 0. This 1 borrowed from the 2’s column becomes 10 in the 1’s column. Keep
one 1 in the 1’s column, bring the other 1 to the 2–1 column, which becomes 10 in this column. Keep
one 1 in the 2–1 column and bring the other 1 to the 2–2 column, which becomes 10 in this column.
Therefore,
15 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM
Now, in the 2’s column, a 1 cannot be subtracted from a 0; so, borrow a 1 from the 4’s column.
But the 4’s column has a 0. So, borrow a 1 from the 8’s column, making the 8’s column 0, and bring it
to the 4’s column. It becomes 10 in the 4’s column. Keep one 1 in the 4’s column and bring the second
1 to the 2’s column making it 10 in the 2’s column. Therefore,
In the 2’s column 10 – 1 = 1
In the 4’s column 1–1=0
In the 8’s column 0–0=0
Our computer can understand only (0, 1) language. The binary numbers are represented in both ways,
i.e., signed and unsigned. The positive numbers are represented in both ways- signed and unsigned,
but the negative numbers can only be described in a signed way. The difference between unsigned
and signed numbers is that unsigned numbers do not use any sign bit for positive and negative
numbers identification, but the signed number used.
Unsigned Numbers
As we already know, the unsigned numbers don't have any sign for representing negative
numbers. So the unsigned numbers are always positive. By default, the decimal number
representation is positive. We always assume a positive sign in front of each decimal digit.
There is no sign bit in unsigned binary numbers so it can only represent its magnitude. In zero and
one, zero is an unsigned binary number. There is only one zero (0) in this representation, which is
always positive. Because of one unique binary equivalent form of a number in unsigned number
representation, it is known as unambiguous representation technique.
Binary number of (102)10 is (1100110)2, a 7-bit magnitude of the decimal number 102.
16 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM
Signed Numbers
So far, we have considered only positive numbers. The representation of negative numbers is also
equally important. There are two ways of representing signed numbers—sign-magnitude form
and complement form. There are two complement forms: 1’s complement form and 2’s
complement form
Most digital computers do subtraction by the 2’s complement method, but some do it by the 1’s
complement method. The advantage of performing subtraction by the complement method is
reduction in the hardware. Instead of subtracting one number from the other, the complement of
the subtrahend is added to the minuend.
Sign-Magnitude
In sign-magnitude form, an additional bit called the sign bit is placed in front of the number.
If the sign bit is a 0, the number is positive. If it is a 1, the number is negative .Apart from this sign-bit,
the n-1 bits represent the magnitude of the number.
For example:
1’s Complement
17 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM
By inverting each bit of a number, we can obtain the 1's complement of a number. The
negative numbers can be represented in the form of 1's complement. In this form, the binary
number also has an extra bit for sign representation as a sign-magnitude form.
The 1’s complement system for representing signed numbers works like this:
1. If the number is positive, the magnitude is represented in its true binary form and a sign bit 0 is
placed in front of the MSB.
2. If the number is negative, the magnitude is represented in its 1’s complement form and a sign bit 1
is placed in front of the MSB.
That is, to represent the numbers in sign 1’s complement form, determine the 1’s complement of the
magnitude of the number and then attach the sign bit. The 1’s complement operation on a signed
number will change a positive number to a negative number and vice versa. The conversion of
complement to true binary is the same as the process used to convert true binary to complement. The
representation of + 51 and – 51 in both 1’s complement forms is shown below:
For Example:
2
’s Complement
By inverting each bit of a number and adding plus 1 to its least significant bit, we can obtain the 2's
complement of a number. The negative numbers can also be represented in the form of 2's
complement. In this form, the binary number also has an extra bit for sign representation as a sign-
magnitude form.
The 2’s complement system for representing signed numbers works like this:
1. If the number is positive, the magnitude is represented in its true binary form and a sign bit 0 is
placed in front of the MSB.
2. If the number is negative, the magnitude is represented in its 1’s complement form and a sign bit 1
is placed in front of the MSB.
That is, to represent the numbers in sign 2’s complement form, determine the 2’s complement of the
magnitude of the number and then attach the sign bit. The 2’s complement operation on a signed
number will change a positive number to a negative number and vice versa. The conversion of
complement to true binary is the same as the process used to convert true binary to complement. The
representation of + 51 and – 51 in both 2’s complement forms is shown below:
For Example:
18 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM
The below example shows +51 and -51 in all signed representation
In 1’s complement subtraction, add the 1’s complement of the subtrahend to the minuend. If
there is a carry out, bring the carry around and add it to the LSB. This is called the end around carry.
Look at the sign bit (MSB). If this is a 0, the result is positive and is in true binary. If the MSB is a 1
(whether there is a carry or no carry at all), the result is negative and is in its 1’s complement form.
Take its 1’s complement to get the magnitude in binary.
19 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM
The 2’s complement system is used to represent negative numbers using modulus arithmetic.
The word length of a computer is fixed. That means, if a 4-bit number is added to another 4-bit
number, the result will be only of 4 bits. Carry, if any, from the fourth bit will overflow. This is called
the modulus arithmetic.
For example: 1100 + 1111 = 1011. In the 2’s complement subtraction, add the 2’s complement
of the subtrahend to the minuend. If there is a carry out, ignore it. Look at the sign bit, i.e. MSB of the
sum term. If the MSB is a 0, the result is positive and is in true binary form. If the MSB is a 1 (whether
there is a carry or no carry at all) the result is negative and is in its 2’s complement form. Take its 2’s
complement to find its magnitude in binary.
20 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM
Example 3: Add – 45.75 to + 87.5 using the 12-bit 2’s complement arithmetic.
Example 4: Add 27.125 to – 79.625 using the 12-bit 2’s complement arithmetic
There is no carry. The MSB is a 1 indicating that the result is negative and is in its 2’s
complement form. The 2’s complement of 11001011.1000 is 00110100.1000. Therefore, the result is
– 52.5.
Binary codes can be classified as numeric codes and alphanumeric codes. Numeric codes
are codes which represent numeric information, i.e. only numbers as a series of 0s and 1s. 8421, XS-3,
Gray code are numeric codes. Numeric codes used to represent the decimal digits are called
Binary Coded Decimal (BCD) codes. 8421, 2421, 5211 are BCD codes. Alphanumeric codes are
codes which represent alphanumeric information, i.e. letters of the alphabet and decimal numbers as a
sequence of 0s and 1s. EBCDIC code and ASCII code are alphanumeric codes.
21 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM
Binary Coded Decimal number system is system in which decimal numbers from 0 to 9 are
represented by four bit binary number. It is often called BCD number system. Each bit of BCD
number has a positional weight. The weights are assigned as per the position occupied by these digits.
The weight of the first position (right most) is 2 0(1), the second 21(2), the third 22 (4) and the fourth
23(8). Reading from left to right, the weights are 8-4-2-1, and hence binary coded decimal number
system is also called 8421 code.
The binary conversion of 7 is (111)2, but the same number is represented in Binary Coded Decimal
system in four bit form as (0111). Also, the numbers from 0 to 9 are represented in the same way as in
binary system but after 9 the representation in BCD are different. For example, the decimal number
12 in binary system is (1100)2 but the same number in BCD is represented as [0001 0010]. Note that
each digit (1 & 2 separately) has been replaced by its equivalent 4-bit binary form.
The representation of decimal numbers from 0 to 15 in binary and equivalent binary coded decimal
system is tabulated below:
In this code, each decimal digit, 0 through 9, is coded by a 4-bit binary number. It is also called
the natural binary code because of the 8, 4, 2 and 1 weights attached to it. It is a weighted code and is
also sequential. Therefore, it is useful for mathematical operations. The main advantage of this code
is its ease of conversion to and from decimal. It is less efficient than the pure binary, in the sense
that it requires more bits. For example, the decimal number 14 can be represented as 1110 in pure
binary but as 0001 0100 in 8421 code. Another disadvantage of the BCD code is that, arithmetic
operations are more complex than they are in pure binary. There are six illegal combinations
1010, 1011, 1100, 1101, 1110 and 1111 in this code, i.e. they are not part of the 8421 BCD code
system. A disadvantage of the 8421 code is that, the rules of binary addition and subtraction do not
apply to the entire 8421 number but only to the individual 4-bit groups.
22 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM
BCD Addition
BCD is a numerical
code. Many
applications
require arithmetic
operations.
Addition is the
most important of
theses because the
other operation,
namely subtraction,
multiplication
and division, can
be done using addition.
23 | Page
S1BCA DIGITAL FUNDAMENTALS NUMBER SYSTEM
24 | Page