Binary Numbers : An Extended Summary
Number
System is a writing system that exists for the purpose of expressing numbers;
that is, a mathematical notation for representing numbers of a given set, using
digits or other symbols in a consistent manner. Here, we discuss about
positional number systems with positive radix (also known as base). In general,
a number system with base ‘r’ contains ‘r’ number of digits, that go from 0,1,
2, …. r-1.
When
we type some letters or words, the computer translates them in numbers as
computers can understand only numbers. A computer can understand the positional
number system where there are only a few symbols, called digits and these
digits represent different values depending on the position they occupy in the
number.
The
value of each digit in a number can be determined using-
i)
The digit
ii)
The position of the digit in the
number
iii)
And. The base of the number system
The
computer architecture supports the following number systems,
·
Binary Number System
·
Decimal Number System
·
Octal Number System
·
Hexadecimal Number System
Binary
Number System is the number system with base 2 that is, there are only two
digits. This is the very reason that makes them to be known as base 2 number
system.
Binary
numbers are expressed with a combination of 1’s and 0’s and possibly with a
binary point in it. The decimal equivalent of a binary number can be found by
expanding the number into a power series with a base of 2.
Digits
in a binary number are called bits (Binary digITs). When a bit is
equal to 0, it does not contribute to the sum during conversion. Therefore, the
conversion to decimal can be obtained by adding the numbers with powers of 2
corresponding to the bits that are equal to 1.
In
computer system,
·
210
is referred to as K (Kilo)
·
220 as M (Mega)
·
230 as G (giga)
·
240 as T (Tera) and so
on.
Decimal
Number System is the number system with base-10. The digits range from 0, 1, 2,
3, …. 9.
This
is the number system that we use in our everyday life. The numbers are
represented by combinations of digits defined above, possibly with a decimal
point. Depending on its position in the string, each digit has an associated
value of an integer raised to the power of 10.
Octal
Number System is the number system with base-8. The digits range from 0, 1, 2,
…. 7.
The
octal numbers are expressed with the combination of digits defined above,
possibly with an octal point in it. The decimal equivalent of a octal number
can be found by expanding the number into a power series with a base of 8.
Hexadecimal Number System is the
number system with base-16. The digits range from 0 to 9 and also comprise of
alphabets A to F. Thus, it is an alphanumeric number system.
Here, A is equivalent to decimal
10, B is equivalent to decimal 11 and so on. The hexadecimal numbers are
expressed with the combination of digits defined above, possibly with a
hexadecimal point in it. The decimal equivalent of a hexadecimal number can be
found by expanding the number into a power series with a base of 16.
1.5
Importance
of Number System
Number
Systems is crucial for understanding the processing of digital system. Digital
system takes binary, octal & hexadecimal number as input and process it and
generates output. Thus, in the field of information technology or embedded
system everywhere one need to be well aware of number system in order to
understand its operation.
The
easiest way to vary instructions through electric signals is two-state system –
on and off. On is represented as 1 and off as 0, though 0 is not actually no
signal but signal at a lower voltage. The number system having just these two
digits – 0 and 1 – is called binary number system and that is how computer
function in general.
Here, is an equivalence chart for numeric
values in different number systems.
Decimal (Base 10) |
Binary (Base 2) |
Octal (Base 8) |
Hexadecimal (Base 16) |
00 |
0000 |
00 |
0 |
01 |
0001 |
01 |
1 |
02 |
0010 |
02 |
2 |
03 |
0011 |
03 |
3 |
04 |
0100 |
04 |
4 |
05 |
0101 |
05 |
5 |
06 |
0110 |
06 |
6 |
07 |
0111 |
07 |
7 |
08 |
1000 |
10 |
8 |
09 |
1001 |
11 |
9 |
10 |
1010 |
12 |
A |
11 |
1011 |
13 |
B |
12 |
1100 |
14 |
C |
13 |
1101 |
15 |
D |
14 |
1110 |
16 |
E |
15 |
1111 |
17 |
F |
Decimal, Binary,
Octal and Hexadecimal number systems are positional number systems. These
number systems co-exist in the same environment. Thus, we can convert a number
that exists in a number system to another and so on. Here, we study about how
we can convert these numerical values from one number system to another with
vice versa.
For this
conversion, we expand the number into a power series with a base of 2 and
calculate the sum that exists in decimal system. Here, when a binary number is
to be converted, the individual digits are multiplied from Most Significant
Digit to Least Significant Digit with decrement in the power to the base.
For example:
·
Convert
(1111)2 into a decimal number.
Solution:
Given binary number is (1111)2.
Here,
multiplying each digit from MSD to LSD, with decrement in power to the base, we
get,
=
1 x 23 + 1 x 22 + 1 x 21 + 1 x 20
=
1 x 8 + 1 x 4 + 1 x 2 + 1 x 1
=
8 + 4 + 2 + 1
=
15
Thus,
(1111)2 = (15)10.
For this
conversion, we group 3 individual bits from the least significant bits and move
along towards the most significant ones. If there is only a single or double
bit remaining in the pairing made from the most significant side, 0s can be
added to make up a group of three. Then, the groups are paired up from their
equivalence chart and the corresponding octal value is written, which can be
seen in equivalence
chart.
At last, the equivalent octal digits are paired from the least significant ones
to the most significant value.
For example:
·
Convert
(1011011011)2 into an octal number.
Solution: Given
binary number is (1011011011)2.
Here, a pair of 3
bits is made from the LSD to MSDs. Then, their equivalent octal value is
written.
Binary Value |
1011011011 |
|||||
Paired Value |
001 |
011 |
011 |
011 |
||
Octal Equivalent |
1 |
3 |
3 |
3 |
|
|
Octal Value |
1333 |
|
||||
Thus, (1011011011)2
= (1333)8.
For this
conversion, we group 4 individual bits from the least significant bits and move
along towards the most significant ones. If there is only a single-double or
triple bit remaining in the pairing made from the most significant side, 0s can
be added to make up a group of four. Then, the groups are paired up from their
equivalence chart and the corresponding hexadecimal value is written, which can
be seen in equivalence chart. At last, the equivalent
hexadecimal digits are paired from the least significant ones to the most
significant value.
For example:
·
Convert
(110101111)2 into a hexadecimal number.
Solution: Given
binary number is (110101111)2.
Here, a pair of 4
bits is made from the LSD to MSDs. Then, their equivalent hexadecimal value is
written.
Binary Value |
110101111 |
|||
Paired Value |
0001 |
1010 |
1111 |
|
Hexadecimal
Equivalent |
1 |
A |
F |
|
Hexadecimal
Value |
1AF |
|
Thus, (110101111)2 = (1AF)16.
Decimal numbers
can be converted to binary by repetitive division of the number by 2 while the
remainders are noted down. Then, the remainders are written collectively from
the last division to the direction of first.
For Example:
·
Convert
(55)10 into a binary number.
Solution:
Here, (55)10 is a decimal number.
The
number is repetitively divided by 2 and the remainders are collectively further
written from the last division to the first to obtain the binary number.
2 |
55 |
Remainder |
|
2 |
27 |
1 |
|
2 |
13 |
1 |
|
2 |
6 |
1 |
|
2 |
3 |
0 |
|
2 |
1 |
1 |
|
|
0 |
1 |
|
|
Thus, (55)10 = (110111)2.
Octal Numbers can
be converted with the simple method of writing up the equivalent values of the
individual octal values in the binary form and alas, pairing them up to get the
corresponding binary value. Each octal digit gives 3 binary digits which can be
seen in equivalence
chart.
Example:
·
Convert
(42076)8 into a binary number.
Solution:
Here, (42076)8 is an octal number.
Individual
octal digits share an equivalent binary value and they are written together to
get the binary value.
Octal Value |
42076 |
||||
Individual Value |
4 |
2 |
0 |
7 |
6 |
Equivalent Binary Value |
100 |
010 |
000 |
111 |
110 |
Binary Value |
100010000111110 |
Thus, (42076)8
= (100010000111110)2.
Hexadecimal
Numbers can be converted with the simple method of writing up the equivalent
values of the individual hexadecimal values in the binary form and alas,
pairing them up to get the corresponding binary value. Each hexadecimal digit
gives 4 binary digits which can be seen in equivalence chart.
Example:
·
Convert
(A23BC)16 into a binary number.
Solution:
Here, (A23BC)16 is a hexadecimal number.
Individual
octal digits share an equivalent binary value and they are written together to
get the binary value.
Hexadecimal Value |
A23BC |
||||
Individual Value |
A |
2 |
3 |
B |
C |
Equivalent Binary Value |
1010 |
0010 |
0011 |
1011 |
1100 |
Binary Value |
10100010001110111100 |
Thus, (A23BC)16
= (10100010001110111100)2.
Complements are
used in digital computers for simplifying the subtraction operation and for
logical manipulation. There are two types of complements for each base-r
system: r's complement and the second as the (r - 1)'s complement. When the
value of the base r is substituted, the two types are referred to as the 2's
complement and 1's complement for binary numbers, the 10's complement and 9's
complement for decimal numbers etc. The 1’s complement and the 2’s complement
of a binary number is important because they permit the representation of
negative numbers. The method of 2’s complement arithmetic is commonly used in
computers to handle negative numbers.
3.1
Diminished Radix Complement
(r-1)’s complement
of a number N is defined as (rn-1) – N. This complement is also
known as diminished radix complement.
Here, N is the
given number
r is the base of number system
n is the number of digits in the given
number
For example, in
the decimal number system; r = 10 and (r-1) = 9, so the 9’s complement of N is (10n-1)
– N.
Then, for a number(N)
that is 46920,
r = 10
r -1 = 9
n = 5
Thus, 9’s complement of the given
number can be found by,
(105 –
1) – 46920 = 99999 – 46920 = 53079
This indicates that 9’s complement of
a decimal number can be obtained by subtracting the given number from a number
that is as long as the given number which comprises of all 9s.
Similarly, in the
binary number system; r = 2 and (r-1) = 1, so the 2’s complement of N is (2n-1)
– N.
Then, for a
number(N) that is 11010,
r = 2
r -1 = 1
n = 5
Thus, 1’s complement of the given
number can be found by,
(25 – 1)
– 11010 = (100000 – 1) - 11010 = 101
The catch here is, the (2n-1)
term is further converted into a binary number. This indicates that 1’s
complement of a binary number can be obtained by subtracting the given number
from a number that is as long as the given number which comprises of all 1s. However,
when subtracting binary digits from 1, we can have either 1 – 0 = 1 or 1 – 1 =
0, which causes the bit to change from 0 to 1 or from 1 to 0, respectively.
Therefore, the 1’s complement of a binary number is formed by changing 1’s to
0’s and 0’s to 1’s.
3.2
Radix Complement
r’s complement of
a number N is defined as rn-N for N ≠ 0. This complement is also
known as radix complement.
Here, N is the
given number
r is the base of number system
n is the number of digits in the given
number
Comparing with the
(r – 1)’s complement, we note that the r’s complement is obtained by adding 1
to the (r – 1)’s complement, since rn – N = [(rn – 1) –
N] + 1. Thus, the 10’s complement of decimal 5946 is 4053 + 1 = 4054. This
indicates that the 10’s complement can simply be found by adding 1 to the 9’s
complement. Similarly, 2’s complement of binary 1110010 is 1101 + 1 = 1110,
which is by adding 1 to the 1’s complement of the given number.
In the previous
definitions, it was assumed that the numbers did not have a radix point. If the
original number N contains a radix point, the point should be removed
temporarily in order to form the r’s or (r – 1)’s complement. The radix point
is then restored to the complemented number in the same relative position. It
is also essential to mention that the complement of the complement restores the
number to its initial state. To see this relationship, we can see that the r’s
complement of N is rn – N, so that the complement of the complement
is rn – (rn – N) which is equals to N, N being the
original number.
4.
Complement
Method of Subtraction
The direct method
of subtraction inculcated in school level implements the borrowing concept.
This method instructs us to borrow a 1 from a higher significant value when the
minuend digit is smaller than the subtrahend digit. This method is all fine and
dandy when performed with a pen and paper but the digital hardware has a hard
time implementing this, thus the method that these systems depend upon is
complement subtraction.
The subtraction of
two n-digit unsigned numbers M – N in base-r can be done in the following ways:
i.
The
minuend M is added to the r’s complement of the subtrahend M.
This performs, M + (rn – N) = M – N + rn.
ii.
Then,
if M >= N, then the sum produced will generate an end carry, rn
which is discarded leaving the result M – N.
iii.
In
case M < N, the sum does not produce an end carry and is equal to rn
– (N – M), which is the r’s complement of (N – M). Further to gain the familiar
form, we calculate the r’s complement of the sum and place a negative sign in
front.
For Example:
a.
Using
10’s complement, subtract 76250 – 95420.
M
= 76250
10’s
complement of N = +04580
Sum = 80830
Answer:
-(10’s complement of 80830) = -19169
b.
Using
10’s complement, subtract 56789 – 12345.
M = 56789
10’s
complement of N = + 87655
Sum = 144444
Discard end carry 105 = - 100000
Answer
= 44444
c.
Using
2’s complement, subtract 1100110 – 1001101.
M =
1100110
2’s complement of N = + 110011
Sum = 10011001
Discard end carry 28 = - 10000000
Answer = 11001
Subtraction
of unsigned numbers can also be done by means of the (r-1)’s complement. We
have to remember that the (r-1)’s complement is one less than the r’s
complement. Because of this, the result of adding the minuend to the complement
of the subtrahend produces a sum that is one less than the correct difference
when an end carry occurs. Removing the end carry and adding 1 to the sum is
referred to as an end-around carry. The procedure with end-around carry is also
applicable to subtracting unsigned decimal numbers with 9’s complement.
I.
Digital
Fundamentals – Ninth Edition, Thomas L. Floyd and Jain
II.
Digital Logic and
Computer Design – Morris Mano
III.
Digital Design –
Mano and Ciletti
IV.
What is Number System? - Types of Number System & Significance -
Electronics Coach
V.
What Are The Importance Of Computer Number System? -
Blurtit
VI.
Numeral system - Simple English Wikipedia, the free encyclopedia
VII.
Number Systems: An Introduction to Binary,
Hexadecimal, and More (tutsplus.com)
Comments
Post a Comment