Intro to other bases

From Compsci1

Revision as of 18:20, 11 October 2006 by Admin (Talk | contribs)
(diff) ←Older revision | view current revision (diff) | Newer revision→ (diff)

Introduction to other bases.

Write down all the digits you know.

There are 10 digits. This is called base 10 or denary. Does this mean that we can only count as far as the number of digits. What happens if we want to count the following • * * * * * * * * * *

What happens if we want to count

  • * * * * * * * * *
  • * * * * * * * * *
  • * * * * * * * * *
  • * * * * * * * * *
  • * * * * * * * * *
  • * * * * * * * * *
  • * * * * * * * * *
  • * * * * * * * * *
  • * * * * * * * * *
  • * * * * * * * * *

What do the digits in a number such as

1023 actually represent?

The 3 is units

The 2 is tens

The 0 is hundreds

The 1 is thousands

1023 = 1x 1000 + 0x100 + 2x10 + 3x1

= 1 x 103 + 0 x 102 + 2 x 101 + 3 x 100

What happens if we only have 2 digits, 0 and 1.

Count in this code:

0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, etc.

This code or base which only has 2 digits – 0 and 1 – is called binary code and is the language of a computer.

If we look at binary numbers in the same way we look at base 10, then a number such as 111 = 1 x 22 + 1 x 21 + 1 x 20

= 1 x 4 + 1 x 2 + 1 x 1

= 4 + 2 + 1 = 7 in base 10.

An easy way to change a number from base 10 to base 2 is to divide repeatedly by 2, writing out the

remainer each time as follows:

To change 23 from base 10 to base 2

2 23

2 11 + 1

2 05 + 1

2 02 + 1

2 01 + 1

2 00 + 1

If we read the remainders from the bottom up the answer is 2310 = 111112

Try changing the following numbers from base 10 to base 2 using the above method

8

12

15

19

39

45

27

12

63

64

65

124

126

127

128

129

299

What patterns do we see emerge?

If the decimal number is odd the binary number will end in 1.

If the decimal number is even the binary number will end in 0.

As the decimal numbers get bigger the binary numbers become very long.

Personal tools
Handy Pages