Vous êtes sur la page 1sur 15

TOPIC: Advantage and application of binary

number system

Submitted by: Submitted To:


Sanjeev Sharma Miss Gaganpreet
kour
B.tech (cse) (Dep. Of ece)
Reg.no. 10802027
Sec. D1801A27
ACKNOWLEDGEMENT:

I am highly indebted to our faculty( miss Gaganpreet kour) for providing me necessary guidance and
inspirational support throughout this work, without which this work would not have been in present shape.

I am also thankful to (Miss Gaganpreet kour) for providing their full support, at all the times whole
heartedly, without which it was impossible to complete this work.

I also extend my thanks to library staff of the my college for their corporation. And I would also like to
thank all my teachers who have helped me directly or
indirectly during my work.

SANJEEV SHARMA
RD1801A27

Content
 Binary number system
 Introduction of binary number system
 Basic concepts of binary number system
 Binary addition
 Binary division
 Binary multiplication

 Another algorithm for converting decimal to binary


 Signed Magnitude
 One’s complement
 Two’s complement
 Binary operation
 Binary Number System A Binary Number is made up of only 0s and 1s.

 Negation in the Binary System

 Application of binary number system

 Position notation

 Bibliography
Binary Number System numbers for everyday calculations. There
are no shortcuts for converting a number
from the commonly used denary scale
(base ten) to the binary scale.
The binary number system, base two, uses
only two symbols, 0 and 1. Two is the Over the years, several prominent
smallest whole number that can be used as mathematicians have recognized the
the base of a number system. For many potential of the binary system. Francis
years, mathematicians saw base two as a Bacon (1561-1626) invented a "bilateral
primitive system and overlooked the alphabet code," a binary system that used
potential of the binary system as a tool for the symbols A and B rather than 0 and 1. In
developing computer science and many his philosophical work, The Advancement
electrical devices.Base two has several of Learning , Bacon used his binary system
other names, including the binary to develop ciphers and codes. These
positional numeration system and the studies laid the foundation for what was to
dyadic system. Many civilizations have used become word processing in the late
the binary system in some form, including twentieth century. The American Standard
inhabitants of Australia, Polynesia, South Code for Information Interchange (ASCII),
America, and Africa. Ancient Egyptian adopted in 1966, accomplishes the same
arithmetic depended on the binary system. purpose as Bacon's alphabet code. Bacon's
Records of Chinese mathematics trace the discoveries were all the more remarkable
binary system back to the fifth century and because at the time Bacon was writing,
possibly earlier. The Chinese were probably Europeans had no information about the
the first to appreciate the simplicity of Chinese work on binary systems.
noting integers as sums of powers of 2,
with each coefficient being 0 or 1. For A German mathematician, Gottfried
example, the number 10 would be written Wilhelm von Leibniz (1646-1716), learned
as 1010: of the binary system from Jesuit
missionaries who had lived in China. Leibniz
10= 1 x 23 + 0 x 22 + 1 x 21 + 0 x 20 was quick to recognize the advantages of
the binary system over the denary system,
Users of the binary system face something
but he is also well known for his attempts
of a trade-off. The two-digit system has a
to transfer binary thinking to theology. He
basic purity that makes it suitable for
speculated that the creation of the
solving problems of modern technology.
universe may have been based on a binary
However, the process of writing out binary
scale, where "God, represented by the
numbers and using them in mathematical
number 1, created the Universe out of
computation is long and cumbersome,
nothing, represented by 0." This widely
making it impractical to use binary
quoted analogy rests on an error, in that it
is not strictly correct to equate nothing decimal.The binary system, once dismissed
with zero. as primitive, is thus central to the
development of computer science and
many forms of electronics. Many important
tools of communication, including the
typewriter, cathode ray tube, telegraph,
The English mathematician and logician and transistor, could not have been
George Boole (1815-1864) developed a developed without the work of Bacon and
system of Boolean logic that could be used Boole. Contemporary applications of binary
to analyze any statement that could be numerals include statistical investigations
broken down into binary form (for and probability studies. Mathematicians
example, true/false, yes/no, male/female). and everyday citizens use the binary system
Boole's work was ignored by to explain strategy, prove mathematical
mathematicians for 50 years, until a theorems, and solve puzzles.
graduate student at the Massachusetts
Institute of Technology realized that
Boolean algebra could be applied to
problems of electronic circuits. Boolean Basic Concepts behind the Binary
logic is one of the building blocks of System
computer science, and computer users
To understand binary numbers, begin by
apply binary principles every time they recalling elementary school math. When we
conduct an electronic search. first learned about numbers, we were taught
that, in the decimal system, things are
The binary system works well for organized into columns:
computers because the mechanical and
H | T | O
electronic relays recognize only two states
1 | 9 | 3
of operation, such as on/off or such that "H" is the hundreds column, "T" is
closed/open.Operational characters 1 and the tens column, and "O" is the ones
0 stand for 1 = on = closed circuit = true 0 = column. So the number "193" is 1-
off = open circuit = falseThe telegraph hundreds plus 9-tens plus 3-ones.
system, which relies on binary code,
demonstrates the ease with which binary Years later, we learned that the ones column
numbers can be translated into electrical meant 10^0, the tens column meant 10^1,
impulses. The binary system works well the hundreds column 10^2 and so on, such
that
with electronic machines and can also aid
in encrypting messages. Calculating 10^2|10^1|10^0
machines using base two convert decimal 1 | 9 | 3
numbers to binary form, then take the the number 193 is really
process back again, from binary to {(1*10^2)+(9*10^1)+(3*10^0)}.
As you know, the decimal system uses the  11110
digits 0-9 to represent numbers. If we
wanted to put a larger number in column Remember:
10^n (e.g., 10), we would have to multiply 2^4| 2^3| 2^2| 2^1| 2^0
10*10^n, which would give 10^(n+1), and | | | 1 | 0
be carried a column to the left. For example, | | 1 | 1 | 1
putting ten in the 10^0 column is 1 | 0 | 1 | 0 | 1
impossible, so we put a 1 in the 10^1 1 | 1 | 1 | 1 | 0
column, and a 0 in the 10^0 column, thus
using two columns. Twelve would be
12*10^0, or 10^0(10+2), or 10^1+2*10^0, Binary Addition
which also uses an additional column to the
left (12).
Consider the addition of decimal numbers:
The binary system works under the exact
23
same principles as the decimal system, only +48
it operates in base 2 rather than base 10. In ___
other words, instead of columns being
We begin by adding 3+8=11. Since 11 is
10^2|10^1|10^0 greater than 10, a one is put into the 10's
they are column (carried), and a 1 is recorded in the
one's column of the sum. Next, add {(2+4)
2^2|2^1|2^0 +1} (the one is from the carry)=7, which is
put in the 10's column of the sum. Thus, the
Instead of using the digits 0-9, we only use answer is 71.
0-1 (again, if we used anything larger it
would be like multiplying 2*2^n and getting Binary addition works on the same
2^n+1, which would not fit in the 2^n principle, but the numerals are different.
column. Therefore, it would shift you one Begin with one-bit binary addition:
column to the left. For example, "3" in
binary cannot be put into one column. The 0 0 1
first column we fill is the right-most +0 +1 +0
column, which is 2^0, or 1. Since 3>1, we ___ ___ ___
need to use an extra column to the left, and 0 1 1
indicate it as "11" in binary (1*2^1) +
(1*2^0). 1+1 carries us into the next column. In
decimal form, 1+1=2. In binary, any digit
  higher than 1 puts us a column to the left (as
would 10 in decimal notation). The decimal
Try converting these numbers from binary number "2" is written in binary notation as
to decimal: "10" (1*2^1)+(0*2^0). Record the 0 in the
ones column, and carry the 1 to the twos
 10 column to get an answer of "10." In our
vertical notation,
 111
 10101 1
+1 111 101 111
___ +110 +111 +111
10 ______ _____ _____
1101 1100 1110
The process is the same for multiple-bit
binary numbers: Binary Multiplication
1010
Multiplication in the binary system works
+1111
the same way as in the decimal system:
______
 1*1=1
 Step one:
 1*0=0
Column 2^0: 0+1=1.
 0*1=0
Record the 1. 
Temporary Result: 1; Carry: 0 101
 Step two: * 11
Column 2^1: 1+1=10.  ____
Record the 0, carry the 1. 101
Temporary Result: 01; Carry: 1 1010
 Step three: _____
Column 2^2: 1+0=1 Add 1 from 1111
carry: 1+1=10. 
Record the 0, carry the 1. Note that multiplying by two is extremely
Temporary Result: 001; Carry: 1 easy. To multiply by two, just add a 0 on
 Step four: the end.
Column 2^3: 1+1=10. Add 1 from
carry: 10+1=11. Binary Division
Record the 11. 
Follow the same rules as in decimal
Final result: 11001
division. For the sake of simplicity, throw
away the remainder.
Alternately:
For Example: 111011/11
11 (carry)
1010
+1111
10011 r 10
______
_______
11001
11)111011
-11
Always remember ______
101
 0+0=0 -11
 1+0=1 ______
 1+1=10 101
11
Try a few examples of binary addition: ______
10 we would put a 1 in the 2^6 column, and
subtract 64 from 75, giving us 11. The
Decimal to Binary largest power of 2 in 11 is 8, or 2^3. Put 1
in the 2^3 column, and 0 in 2^4 and 2^5.
Converting from decimal to binary notation
is slightly more difficult conceptually, but Subtract 8 from 11 to get 3. Put 1 in the
can easily be done once you know how 2^1 column, 0 in 2^2, and subtract 2 from
through the use of algorithms. Begin by 3. We're left with 1, which goes in 2^0, and
thinking of a few examples. We can easily we subtract one to get zero. Thus, our
see that the number 3= 2+1. and that this is
equivalent to (1*2^1)+(1*2^0). This number is 1001011.
translates into putting a "1" in the 2^1
column and a "1" in the 2^0 column, to get Making this algorithm a bit more formal
"11". Almost as intuitive is the number 5: it gives us:
is obviously 4+1, which is the same as
saying [(2*2) +1], or 2^2+1. This can also 1. Let D=number we wish to convert
be written as [(1*2^2)+(1*2^0)]. Looking at from decimal to binary
this in columns, 2. Repeat until D=0
o a. Find the largest power of
2^2 | 2^1 | 2^0 two in D. Let this equal P.
1 0 1 o b. Put a 1 in binary column
or 101. P.
o c. Subtract P from D.
What we're doing here is finding the largest 3. Put zeros in all columns which don't
power of two within the number (2^2=4 is have ones.
the largest power of 2 in 5), subtracting that
from the number (5-4=1), and finding the This algorithm is a bit awkward. Particularly
largest power of 2 in the remainder (2^0=1
is the largest power of 2 in 1). Then we just step 3, "filling in the zeros." Therefore, we
put this into columns. This process should rewrite it such that we ascertain the
continues until we have a remainder of 0. value of each column individually, putting
Let's take a look at how it works. We know in 0's and 1's as we go:
that:
1. Let D= the number we wish to
2^0=1
2^1=2 convert from decimal to binary
2^2=4 2. Find P, such that 2^P is the largest
2^3=8 power of two smaller than D.
2^4=16 3. Repeat until P<0
2^5=32 o If 2^P<=D then
2^6=64  put 1 into column P
2^7=128  subtract 2^P from D
and so on. To convert the decimal number o Else
75 to binary, we would find the largest  put 0 into column P
power of 2 less than 75, which is 64. Thus, o End if
o Subtract 1 from P All binary numbers are in the form

Now that we have an algorithm, we can use a[n]*2^n + a[n-1]*2^(n-1)+...


it to convert numbers from decimal to +a[1]*2^1 + a[0]*2^0
binary relatively painlessly. Let's try the where each a[i] is either a 1 or a 0 (the only
number D=55. possible digits for the binary system). The
only way a number can be odd is if it has a
 Our first step is to find P. We know
1 in the 2^0 column, because all powers of
that 2^4=16, 2^5=32, and 2^6=64.
Therefore, P=5. two greater than 0 are even numbers (2, 4,
 2^5<=55, so we put a 1 in the 2^5 8, 16...). This gives us the rightmost digit as
column: 1-----. a starting point.
 Subtracting 55-32 leaves us with 23.
Subtracting 1 from P gives us 4. Now we need to do the remaining digits.
 Following step 3 again, 2^4<=23, so One idea is to "shift" them. It is also easy to
we put a 1 in the 2^4 see that multiplying and dividing by 2 shifts
column: 11----. everything by one column: two in binary is
10, or (1*2^1). Dividing (1*2^1) by 2 gives
 Next, subtract 16 from 23, to get 7.
us (1*2^0), or just a 1 in binary. Similarly,
Subtract 1 from P gives us 3.
multiplying by 2 shifts in the other
 2^3>7, so we put a 0 in the 2^3 direction: (1*2^1)*2=(1*2^2) or 10 in
column: 110--- binary. Therefore
 Next, subtract 1 from P, which gives
us 2. {a[n]*2^n + a[n-1]*2^(n-1)
 2^2<=7, so we put a 1 in the 2^2 + ... + a[1]*2^1 +
column: 1101-- a[0]*2^0}/2
 Subtract 4 from 7 to get 3. Subtract
1 from P to get 1. is equal to
 2^1<=3, so we put a 1 in the 2^1
a[n]*2^(n-1) + a[n-1]*2^(n-2)
column: 11011-
+ ... + a[1]2^0
 Subtract 2 from 3 to get 1. Subtract
1 from P to get 0. Let's look at how this can help us convert
 2^0<=1, so we put a 1 in the 2^0 from decimal to binary. Take the number
column: 110111 163. We know that since it is odd, there
 Subtract 1 from 1 to get 0. Subtract must be a 1 in the 2^0 column (a[0]=1). We
1 from P to get -1. also know that it equals 162+1. If we put
 P is now less than zero, so we stop. the 1 in the 2^0 column, we have 162 left,
and have to decide how to translate the
Another algorithm for remaining digits.
converting decimal to binary Two's column: Dividing 162 by 2 gives 81.
The number 81 in binary would also have a
However, this is not the only approach 1 in the 2^0 column. Since we divided the
possible. We can start at the right, rather number by two, we "took out" one power of
than the left. two. Similarly, the statement a[n-1]*2^(n-1)
+ a[n-2]*2^(n-2) + ... + a[1]*2^0 has a left-most bit is not actually part of the
power of two removed. Our "new" 2^0 number, but is just the equivalent of a +/-
column now contains a1. We learned earlier sign. "0" indicates that the number is
that there is a 1 in the 2^0 column if the positive, "1" indicates negative. In 8 bits,
number is odd. Since 81 is odd, a[1]=1. 00001100 would be 12 (break this down
Practically, we can simply keep a "running into (1*2^3) + (1*2^2) ). To indicate -12,
total", which now stands at 11 (a[1]=1 and we would simply put a "1" rather than a "0"
a[0]=1). Also note that a1 is essentially as the first bit: 10001100.
"remultiplied" by two just by putting it in
front of a[0], so it is automatically fit into One's Complement:
the correct column.
In one's complement, positive numbers are
Four's column: Now we can subtract 1 from
represented as usual in regular binary.
81 to see what remainder we still must place
However, negative numbers are represented
(80). Dividing 80 by 2 gives 40. Therefore,
differently. To negate a number, replace all
there must be a 0 in the 4's column,
zeros with ones, and ones with zeros - flip
(because what we are actually placing is a
the bits. Thus, 12 would be 00001100, and
2^0 column, and the number is not odd).
-12 would be 11110011. As in signed
magnitude, the leftmost bit indicates the
Eight's column: We can divide by two again sign (1 is negative, 0 is positive). To
to get 20. This is even, so we put a 0 in the compute the value of a negative number,
8's column. Our running total now stands at flip the bits and translate as before.
a[3]=0, a[2]=0, a[1]=1, and a[0]=1.
Two's Complement:
Negation in the Binary System

 Signed Magnitude Begin with the number in one's


complement. Add 1 if the number is
 One's Complement
negative. Twelve would be represented as
 Two's Complement 00001100, and -12 as 11110100. To verify
 Excess 2^(m-1) this, let's subtract 1 from 11110100, to get
11110011. If we flip the bits, we get
These techniques work well for non- 00001100, or 12 in decimal.
negative integers, but how do we indicate
negative numbers in the binary system? In this notation, "m" indicates the total
number of bits. For us (working with 8
Before we investigate negative numbers, we bits), it would be excess 2^7. To represent a
note that the computer uses a fixed number number (positive or negative) in excess 2^7,
of "bits" or binary digits. An 8-bit number is begin by taking the number in regular
8 digits long. For this section, we will work binary representation. Then add 2^7 (=128)
with 8 bits. to that number. For example, 7 would be
128 + 7=135, or 2^7+2^2+2^1+2^0, and, in
Signed Magnitude: binary,10000111. We would represent -7 as
128-7=121, and, in binary, 01111001.
The simplest way to indicate negation is
signed magnitude. In signed magnitude, the Note:
 Unless you know which uses 16 symbols
representation has been used, you (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F), so 1 +
cannot figure out the value of a 1 = 2 and 7 + 7 = E. Base-10 and base-
number. 16 number systems are more compact
 A number in excess 2^(m-1) is the than the binary system. Programmers
same as that number in two's use the hexadecimal number system as
a convenient, more compact way to
complement with the leftmost bit
represent binary numbers because it is
flipped.
very easy to convert from binary to
hexadecimal and vice versa. It is more
To see the advantages and disadvantages of
difficult to convert from binary to
each method, let's try working with them.
decimal and from decimal to binary.
Using the regular algorithm for binary The advantage of the binary system is
adition, add (5+12), (-5+12), (-12+-5), and its simplicity. A computing device can
(12+-12) in each system. Then convert back be created out of anything that has a
to decimal numbers. series of switches, each of which can
alternate between an "on" position and
an "off" position. These switches can be
APPLICATION OF BINARY electronic, biological, or mechanical, as
long as they can be moved on
NUMBER SYSTEM command from one position to the
other. Most computers have electronic
The binary number system, also called switches.
the base-2 number system, is a method
of representing numbers that counts by When a switch is "on" it represents the
using combinations of only two value of one, and when the switch is
numerals: zero (0) and one (1). "off" it represents the value of zero.
Computers use the binary number Digital devices perform mathematical
system to manipulate and store all of operations by turning binary switches
their data including numbers, words, on and off. The faster the computer can
videos, graphics, and music. turn the switches on and off, the faster it
can perform its calculations.
The term bit, the smallest unit of digital
technology, stands for "BInary digiT." A Binary Decimal Hexadecimal
byte is a group of eight bits. A kilobyte Number Number Number
is 1,024 bytes or 8,192 bits. System System System
0 0 0
Using binary numbers, 1 + 1 = 10 1 1 1
because "2" does not exist in this 10 2 2
system. A different number system, the 11 3 3
commonly used decimal or base- 100 4 4
10 number system, counts by using 10 101 5 5
digits (0,1,2,3,4,5,6,7,8,9) so 1 + 1 = 2 110 6 6
and 7 + 7 = 14. Another number system 111 7 7
used by computer programmers is the 1000 8 8
hexadecimal system, base-16 , which 1001 9 9
Binary Decimal Hexadecimal
Binary Operations
Number Number Number Binary numbers can be manipulated
System System System with the same familiar operations used
1010 10 A to calculate decimal numbers, but using
1011 11 B only zeros and ones. To add two
1100 12 C numbers, there are only four rules to
1101 13 D remember:
1110 14 E
1111 15 F Therefore, to solve the following
10000 16 10 addition problem, start in the rightmost
Positional Notation column and add 1 + 1 = 10; write down
Each numeral in a binary number takes the 0 and carry the 1. Working with
a value that depends on its position in each column to the left, continue adding
the number. This is called positional until the problem is solved.
notation. It is a concept that also applies
to decimal numbers. To convert a binary number to a
decimal number, each digit is multiplied
For example, the decimal number 123 by a power of two. The products are
represents the decimal value 100 + 20 then added together. For example, to
+ 3. The number one represents translate the binary number 11010 to
hundreds, the number two represents decimal, the formula would be as
tens, and the number three represents follows:
units. A mathematical formula for
generating the number 123 can be To convert a binary number to a
created by multiplying the number in the hexadecimal number, separate the
hundreds column (1) by 100, or 10 ; 2 binary number into groups of four
multiplying the number in the tens starting from the right and then translate
1
column (2) by 10, or 10 ; multiplying the each group into its hexadecimal
number in the units column (3) by 1, or equivalent. Zeros may be added to the
0
10 ; and then adding the products left of the binary number to complete a
together. The formula is: 1 × 10  +2 group of four. For example, to translate
the number 11010 to hexadecimal, the
2 × 101 + 3 × 100 = 123. formula would be as follows:
This shows that each value is multiplied Binary Number System
by the base (10) raised to increasing
powers. The value of the power starts at A Binary Number is made
zero and is incremented by one at each up of only 0s and 1s.
new position in the formula.

This concept of positional notation also


applies to binary numbers with the
difference being that the base is 2. For
example, to find the decimal value of
the binary number 1101, the formula is
1 × 23 + 1 × 22 + 0 × 21 + 1 × 20 = 13.
"Binary is as easy as 1, 10, 11."

Here are some more equivalent


values:

Dec
ima 20 25 30 40 50 100 200 500
l:

Bin 10 11 11 10 11 110 110 111


This is 1×8 + 1×4 ary 10 00 11 10 00 010 010 110
+ 0×2 + 1 +
: 0 1 0 00 10 0 00 100
1×(1/2) + 0×(1/4)
+ 1×(1/8)
(=13.625 in  
Decimal)

How to Show that a Number is Binary


Similar to the Decimal System,
numbers can be placed to the left To show that a number is
or right of the point, to indicate a binary number, follow it with a
values greater than one or less little 2 like this: 1012
than one. For Binary Numbers:
This way people won't think it is
the decimal number "101" (one
2 Different Values
hundred and one).
Because you can only have 0s or
1s, this is how you count using
Binary: Examples
Example 1: What is 11112 in
De
Decimal?
ci 1 1 1 1 1 1
012 3 4 5 6 7 8 9
m 0 1 2 3 4 5  The "1" on the left is in the
al: "2×2×2" position, so that
means 1×2×2×2 (=8)
Bi 1 1 1 1 1 1 1 1  The next "1" is in the "2×2"
1111
11 0 0 0 0 1 1 1 1 position, so that means
na 01 0 0 1 1
01 0 0 1 1 0 0 1 1 1×2×2 (=4)
ry: 0101
0 1 0 1 0 1 0 1  The next "1" is in the "2"
position, so that means 1×2
(=2)
 The last "1" is in the units position, so that means
position, so that means 1 1×(1/2)
 Answer: 1111 = 8+4+2+1 =  The last "1" on the right side
15 in Decimal is in the "quarters" position,
so that means 1×(1/4)
Example 2: What is 10012 in  So, 10.11 is 2+0+1/2+1/4 =
Decimal? 2.75 in Decimal

 The "1" on the left is in the


"2×2×2" position, so that
means 1×2×2×2 (=8)
 The "0" is in the "2×2"
position, so that means
0×2×2 (=0)
 The next "0" is in the "2"
position, so that means 0×2
(=0)
 The last "1" is in the units
position, so that means 1
 Answer: 1001 = 8+0+0+1 =
9 in Decimal

Example 3: What is 1.12 in


Decimal?

 The "1" on the left side is in


the units position, so that
means 1.
 The 1 on the right side is in
the "halves" position, so that
means 1×(1/2)
 So, 1.1 is "1 and 1 half" =
1.5 in Decimal

Example 4: What is 10.112 in


Decimal?

 The "1" is in the "2" position,


so that means 1×2 (=2)
 The "0" is in the units
position, so that means 0
 The "1" on the right of the
point is in the "halves"
Bibliography

 Www. Google .com


 Www.wikipedia.com
 www.yahooanswer.com

 www.pdfsearchengine.com

Vous aimerez peut-être aussi