Embed
Email

Numbers

Document Sample

Shared by: panniuniu
Categories
Tags
Stats
views:
0
posted:
12/11/2011
language:
pages:
8
Digital Fundamentals









Introduction to Number Systems

Supplement







Prepared by Mike Crompton (Rev 20 August 2008)

Number systems.

The need to know „how many‟ of a particular item was one of the first needs of humans,

and many methods of determining „how many‟ were derived. It is now known as

counting and it is a „system‟ of numbers or a „number system‟. Many number systems

have been developed over the ages, some bad, some good for specific types of number

manipulation but no good for every day use, and of course the very flexible every day

system we now use. We will discuss several systems and depending on the system used,

number 11 can be translated as 2, 3, 6, 9, 11 or 17.



One of the early number systems was that used by the Romans (Roman Numeral system).

It assigned amounts to a particular letter of the alphabet because there were no „numbers‟

as such. At right are the commonly used letters and values of this system. To write a

number you started at the left and inserted

the number of letters that corresponded to Letter Value Letter Value

the value you wanted, and moved to the I 1 C 100

right and inserted the next letter(s). For V 5 D 500

example the number 1352 would be

MCCCLII. The M = 1000, the 3 Cs = X 10 M 1000

3x100=300, 1 L = 50 and 2 Is = 2x1=2 or L 50

1000+300+50+2 = 1352. A little

cumbersome but better than no system. However there are two inherent problems with

this system, one being the writing of amounts that were not multiples of the values used.

How do you write the number 99 for example? Well it could be written as 9 X‟s for 90

and 9 I‟s for 9 XXXXXXXXXIIIIIIIII, which as can be seen, is even more cumbersome.

This was over come by adding a smaller letter to the left of a bigger letter (normally

smaller letters go to the right), and subtracting that amount from the larger letter. 1900 for

example would be MCM. The first M = 1000 and then C (100) subtracted from the

second M (1000 – 100) leaves 900 and 1000 + 900 = 1900. The number 1909 would be

MCMIX or first M = 1000, CM = 900 and IX = 10 – 1 = 9 or 1000+900+9 = 1909.

This problem is caused by the 2ND inherent problem, which is the lack of a „Base‟. As

you increment the amount by moving to the next letter, the increase is NOT the same for

each step. Going from I to V increases by a factor of 5, but from V to X is only a factor of

2. This means that the whole system is awkward, cumbersome and difficult to use. So

much so that some people think it resulted in the fall of the Roman Empire. Most people

believe that the demise of the empire was due to eating from lead plates or from over

indulgence in orgies. In fact it is alleged by some that a clever enemy figured out that if

he attacked on New Years Day the Romans would be so busy trying to figure out how to

write the number of the new year that they could walk in unopposed and defeat the

Romans with hardly a shot being fired. Others believe that this number system was

responsible for the 5-day week followed by a 2-day weekend. Apparently every body got

paid on Friday and it took them 2 days to figure out if their paycheque was correct, so it

was Monday before they returned to work. This may or may not be true. However, the

number 11 in this system could be interpreted as 2, which takes care of one of the options

in the first paragraph above.









2

The Arabic number system came to the rescue by using a system that had a Base. That is,

incrementing to the next „symbol‟ always increased by the same factor, so that each

symbol was greater, by the same factor, as the symbol to it‟s right. The Base also

determined the number of digits (or sub-symbols) in each main symbol. This system gave

us the „sub-symbols‟ that have become very familiar to us as the numbers 0 to 9.



Using the Arabic system we can quite easily invent our own number system. Lets call it

the „Solar System‟ and at first use symbols with a Base of 5. This means that each symbol

is worth 5 times the symbol below it (to the right of it). The first symbol  (star) is worth

1. The next symbol  (moon) is worth 5 (5x1=5). The third is  (sun) worth 25 (5x5=25)

and a fourth  (planet) is worth 125 (5x25=125). We could continue but four symbols are

enough to prove our system works.

Using part of the Roman method we could represent the number 56 as  Two suns

= 2x25=50 plus a moon 5, plus a star 1 gives us 50 + 5 + 1 = 56. This is still cumbersome

but at least it has some order. If we now incorporate another part of the Arabic system

and use sub-symbols (the numbers 0 to 4) to denote how many of each symbol we want,

the system becomes much less cumbersome.

The table at right illustrates this. The symbols     Total

now head a column and their relative amounts (125) (25) (5) (1)

are in brackets below. The quantity of each 1 2 0 4 179

symbol we want is written in numbers in the

respective column. The first example indicates

we have 1 planet (125), 2 suns (2x25= 50), no 1 2 1 0 180

moons and 4 stars (4) or 125+50+4 = 179. If we

want to add 1 to this and make it 180 the 1 4 4 4 249

second example shows this. Make special note

of the fact that we cannot put 5 in the star

column because there is no such number in a 2 0 0 0 250

base 5 system. Remember that the base

determines how many digits (sub-symbols) you can use, so base 5 restricts us to 5 digits,

which are the numbers 0 to 4. What we must do is add a moon (5) and take away the 4

stars. We call this „carrying 1‟ in the normal addition process. This gives us a planet

(125), 2 suns (2x25=50), 1 moon (5) and no stars for a total of 125+50+5=180. Another

example of carrying is shown when we add 1 to the third example of 1 planet, 4 suns, 4

moons and 4 stars or 249 + 1 i.e. the fourth example of 2 planets = 2x125=250. Adding

one to the 4 stars means stars go to 0 and we carry a 1 to the moon column. Adding the

carry gives us 4 +1 moons, which drops the moons to 0 and gives us a carry of 1 to the

sun column. This extra sun drops the suns to 0 and gives a carry of 1 into the planet

column for a total of just 2 planets which = 2x125=250. So our invented number system

the „Solar System‟ works and 11 in this system would actually be 6, which accounts for

another of the options in the first paragraph. Hopefully you have noticed that to explain

the other systems we have always had to revert to the only number system we can

actually use and think in, our decimal system. This means that understanding other

systems is virtually impossible for us without our decimal or Base 10 system.









3

The Decimal System (Base 10)



The only number system we as humans can think in is the Base 10 or decimal system and

it should be made clear that, once we become aware of other systems, we should when

writing down a number include the base number as a subscript. e.g. 14310 is 143 decimal.

If the „Solar System‟ actually existed we would subscript it 5, as in 1435 which would be

4810. The Roman system could not be subscripted, as it has no base.

The table at right shows the decimal

system and it‟s relative column values in 1000 100 10 1 Total

the same way as the Solar System table 1 5 7 9 1579

above. We tend to forget that when we

write down a number in the decimal

system we are actually doing the same 1 5 8 0 1580

addition process as in the „Solar‟. We are

so used to it that we don‟t even think 1 9 9 9 1999

about addition we just „say‟ the number

and it registers as an amount in our brain.

The first example actually consists of one 2 0 0 0 2000

1000, five 100s, seven 10s and nine 1s or

1000+500 (5x100)+70 (7x10)+9 (9x1)= 1579 but we just say one thousand five hundred

and seventy nine. To add 1 to 179 we know that the nine 1s + 1 becomes zero, and we

carry a 1 to the tens column making our number 1580 as in the second example. To add 1

to 1999 we do of course have to carry 1 to the tens, 1 to the hundreds and 1 to the

thousands columns to arrive at 2000 as seen in the third and fourth examples. It seems so

easy in the decimal system, and so much harder when we did the same thing in the Solar

System. Of course the number 11 in this system is still 11, taking care of a third option in

paragraph one.



The Octal System. (Base 8)

A number system using base 8 (Octal) is quite common in low-level computer systems,

the PLC (Programmable Logic Controller) is one example. This system will only use 8

digits, the numbers 0 to 7, and 1438 would translate to 9910 . The table below shows how

this is arrived at. As can be seen the LSB or

Least Significant Bit, the digit on the right when 512 64 8 1 Total

dealing with whole numbers, is 1, as it is in all 0 1 4 3 9910

number systems. The next significant bit to the

left is 8 (8x1=8), moving left again we have 64

(8x8=64) and then 512 (8x64=512). The first 1 7 7 7 102310

example in the table has one 64, four 8s

(4x8=32) and three 1s (3) or 64+32+3=99 in

2 0 0 0 102410

decimal. In the second example there is one 512

+ seven 64s (448) + seven 8s (56) + seven 1s (7)

for a total of 1023 decimal. Adding one to this total gives us 20008, via carrying, for a

total of 1024 decimal as in example 3. For a fourth option from the numbers in paragraph

one, 11 in octal would be 9 decimal. This leaves only 2 of the 6 remaining.









4

So far we have done many conversions from different number systems to the decimal

system, but not from decimal to another system. The method is common to all systems

(except the Roman), and consists of dividing the decimal number by the base of the

system to which you wish to convert. You then record the remainder as the LSB of the

other system and repeat the process with the whole number that resulted from the first

division. This sounds complicated, but a couple of examples should ease the pain a little!

Let‟s try the octal system and convert 102310, which we already know from the table

above should be 17778.



1023/8 = 127.875 (.875 x 8 = 7) so the remainder is 7, our LSB.



127/8 = 15.875 so the remainder is again 7 our next bit.



15/8 = 1.875 so once again the remainder is 7 our third bit.



1/8 = 0.125 (.125 x 8 = 1) so the remainder is 1 our final or MSB (Most Significant Bit)



Since the whole number is now zero we stop, and using the first remainder as the LSB

and the last remainder as the MSB, we have 17778.



Now we will try a number we don‟t know the result of, say 245310.



2453/8 = 306.625 0.625 x 8 = 5 remainder is 5



306/8 = 38.25 0.25 x 8 = 2 remainder is 2



38/8 = 4.75 0.75 x 8 = 6 remainder is 6



4/8 = 0.5 0.5 x 8 = 4 remainder is 4



Therefore our number is 46258. To cross check if this is correct, we have 4x512 = 2048

plus 6x64 = 384 plus 2x8 = 16 plus 5x1 = 5 or 2048 + 384 + 16 + 5 = 245310 BINGO!



The Hexa-Decimal (or Hex) system. (Base 16).



On seeing the above heading, the first question that should come to mind is: “How can

you have a number system with a Base of 16?”. If, as we know, the base tells us not only

the relative strength of each column (16 times) but how many digits (16), we only have

10 digits (the numbers 0 to 9), where do the other 6 come from? The answer is “We use

the letters A to F!”. 0 to 9 naturally uses 0 to 9. 10 becomes A, 11 = B, 12 = C, 13 = D,

14 = E and 15 = F. The number 14316 will become 32310 and 14310 will become 8F16. The

table below shows how these values are arrived at, and the carry operation when any

column reaches F (15).









5

The first example is 14316. This gives us

one 256 plus four 16s (4x16 = 64) plus 4096 256 16 1 Total

three 1s (3x1 = 3) or 256+64+3 = 32310. 0 1 4 3 32310

The second example has eight 16s (8x16

= 128) plus F (15) 1s or 128+15 = 14310.

Examples 4 and 5 show the carry 0 0 8 F 14310

operation when 1 is added to FFF16 or

F(15) 256s plus F(15) 16s + F(15) 1s for 0 F F F 409510

a total of (15x256) = 3840 + (15x16) =

240 + (15x1) = 15 = 409510 The final

total, via the carrying, will be 100016 1 0 0 0 409610

which is (1x4096) = 409610. One big

advantage of the Hex system is it‟s economy of digits. It takes 7 digits in the decimal

system to display 1 million, whereas 7 Fs (268,435,45510) represents hundreds of

millions. The decimal equivalent of 11Hex is 17, which only leaves one of our paragraph

one numbers outstanding.



The conversion from decimal to Hex uses the same dividing process used in converting

Octal. To convert 506 decimal to Hex:



506/16 = 31.625 0.625 x 16 = 10(A) therefore remainder = A (LSB)



31/16 = 1.9375 0.9375 x 16 = 15(F) therefore remainder = F



1/16 = 0.0625 0.0625 x 16 = 1 therefore remainder = 1 (MSB)



This gives us 1FA16 Cross checking this we have one 256, fifteen(F) 16s and ten(A) 1s

for a total of 256 + (15x16=)240 + 10 = 50610.



The Binary System. (Base 2).



Binary, the simplest number system that has a base of 2, (only 2 digits) is probably the

most difficult to understand for humans but is ideal for computers. Each column is double

the value of the column on it‟s right, or ½ the value of the column on it‟s left. We cannot

have a number of 1432 as the binary system has only 1s and 0s. However 14310 would be

100011112, using 8 digits to represent 3 decimal digits. Obviously not a „digit

economical‟ system. 11 in binary is 3 decimal, which takes care of the last number option

in paragraph one. The table at right 128 64 32 16 8 4 2 1 Total

shows the relative size of each column

and example 1 is the number 143 1 0 0 0 1 1 1 1 14310

decimal as base 2. The next example is

12710 and when 1 is added to this, the 0 1 1 1 1 1 1 1 12710

final example of 12810 shows the

carrying from each column to the next 1 0 0 0 0 0 0 0 12810

until there is just one 128 (1x128=128).









6

The same method of converting decimal to binary as in Octal and Hex can be used, to

convert 5210 to base 2:



52/2 = 26 remainder 0 (LSB)



26/2 = 13 remainder 0



13/2 = 6 remainder 1



6/2 = 3 remainder 0



3/2 = 1 remainder 1



1/2 = 0 remainder 1 (MSB)



Therefore 5210 = 1101002 Cross checking we have a 32, a 16, no 8, a 4 and no 2s or 1s, so

32+16+4 = 52.



There is one other conversion that has particular importance when dealing with

computers. The central processor of a computer uses nothing but binary. Instructions and

data are always in 1s and 0s, but to save space in both memory and on the monitor screen

the binary numbers are often converted and stored/displayed in Hex. Converting from

one to the other is made much easier by the fact that 4 binary bits represent one hex bit,

and vice versa. Therefore to convert a binary number to hex the first thing to do is to

divide the binary number into groups of four, starting at the LSB and working to the left.

Convert the four bits to decimal, then to their Hex equivalent and then move to the next

group of 4 bits. Going from Hex to binary is simply the reverse process. We can try an

example and convert 1011011110102 to Hex. First divide into groups of four:



1011 0111 1010



Convert to decimal 11 7 10



Convert to Hex B 7 A



Therefore 1011011110102 is equal to B7A16 and to see if this is correct we will convert

both to decimal. First the binary has a 2048 + 512 + 256 + 64 + 32 + 16 + 8 + 2 = 293810

The Hex has 11(B) 256s plus 7 x 16 plus 10(A) 1s or 2816 + 112 + 10 = 293810



From Hex to binary is the reverse. Convert the first (MSB) Hex digit to decimal then to

binary. These will become the 4 highest significant binary bits, the next Hex digit

becomes the 4 next least significant etc. Converting 13F16 to binary we have 116=110=

00012, then 316=310=00112 and finally A16 (LSB), which is 1010 and 10102. The complete

binary number becomes 000100111010 or 100111010 by dropping the 3 leading zeros.









7

Below are several conversion exercises, with the answers contained in the box at right.

Many calculators will do number system conversions, but completing these exercises

with a calculator will not help in understanding number systems. Do them by hand.



1. Convert to Decimal









1a) 87

a) 1278 b) 778 c) 0078 d) 1118 e) 4568









e) 302

d) 73

c) 7

b) 63

2. Convert to Octal

a) 42110 b) 72710 c) 810 d) 5610 e) 111110









2a) 645

3. Convert to Hex









e) 2127

d) 70

c) 10

b) 1327

a) 42110 b) 72710 c) 810 d) 5610 e) 111110



4. Convert to Decimal

a) ABC16 b) 00816 c) 1F16 d) F0F16 e) 000016









3a) 1A5

e) 457

d) 38

c) 8

b) 2D7

5. Convert to Binary

a) 210 b) 9910 c) 39710 d) 25610 e) 25710



6. Convert to Decimal

a) 10101012 b) 12 c) 000010002 d) 111112 e) 1000012









4a) 2748

e) 0

d) 3855

c) 31

b) 8

7. Convert to Hex

a) 110100011111 b) 1012 c) 1100111102 d) 12 e) 110012



8. Convert to Binary









5a) 10

e) 100000001 e) 33

d) 100000000 d) 31

c) 110001101 c) 8

b) 1100011 b) 1

a) 7A116 b) 111116 c) ABC16 d) 00116 e) 10116









7a) D1F 6a) 85

e) 19

d) 1

c) 19E

b) 3

8a) 11110100001

e) 100000001

d) 1

c) 101010111100

b) 1000100010001









8



Related docs
Other docs by panniuniu
organization_of_slp_working_files_3-23-10
Views: 1  |  Downloads: 0
Lesson 2 2011 key
Views: 0  |  Downloads: 0
Site Survey
Views: 2  |  Downloads: 0
alt energy project SP11
Views: 1  |  Downloads: 0
Effie Biography
Views: 0  |  Downloads: 0
Download-Organization-application-letter
Views: 0  |  Downloads: 0
TWIN_Nomination_form_2010
Views: 0  |  Downloads: 0
Engineering Change Order Master Log
Views: 2  |  Downloads: 0
360654.f1
Views: 0  |  Downloads: 0
By registering with docstoc.com you agree to our
privacy policy

You are almost ready to download!

You are almost ready to download!