Numbering System

1 / 29

# Numbering System - PowerPoint PPT Presentation

Numbering System. Base Conversion. Number systems. Decimal – 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Binary – 0, 1 Octal – 0, 1, 2, 3, 4, 5, 6, 7 Hexadecimal system – 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F. Why different number systems?.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about 'Numbering System' - alan-brooks

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

### Numbering System

Base Conversion

Number systems
• Decimal – 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
• Binary – 0, 1
• Octal – 0, 1, 2, 3, 4, 5, 6, 7
• Hexadecimal system – 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
Why different number systems?
• Binary number result in quite a long string of 0s and 1s
• Easier for the computer to interpret input from the user
Base Conversion
• In daily life, we use decimal (base 10) number system
• Computer can only read in 0 and 1
• Number system being used inside a computer is binary (base 2)
• Octal (base 8) and hexadecimal (base 16) are used in programming for convenience
Base Conversion
• Conversion
• Binary number,
• Octal number,
• Decimal number.
Base Conversion

For example:

62 = 111110 = 76 = 3E

1 For Decimal:

62 = 6x101 + 2x100

2 For Binary:

111110 = 1x25 + 1x24 + 1x23 + 1x22 + 1x21 + 0x20

3 For Octal:

76 = 7x81+ 6x80

3E = 3x161 + 14x160

• Since for hexadecimal system, each digit contains number from 1 to 15, thus we use A, B, C, D, E and F to represent 10, 11, 12, 13, 14 and 15.
Binary and decimal system
• Binary to decimal
• X . 27 + X . 26+ X . 25+ X . 24 + X . 23+ X . 22+ X . 21 + X . 20
• Decimal to binary
• Keep dividing the number by two and keep track of the remainders.
• Arrange the remainders (0 or 1) from the least significant (right) to most significant (left) digits
• Binary to Octal (8 = 23)
• Every 3 binary digit equivalent to one octal digit
• Binary to Hexadecimal (16 = 24)
• Every 4 binary digit equivalent to one hexadecimal digit
• Octal to binary
• Every one octal digit equivalent to 3 binary digit
• Every one hexadecimal digit equivalent to 4 binary digits
Base Conversion
• How to convert the decimal number to other number system
• e.g. convert 1810 in binary form

2 |18 ----0

2 |09 ----1

2 |04 ----0

2 |02 ----0

1

• 1810 = 100102
Base Conversion
• e.g. convert 1810 in octal form
• Since for octal form, one digit is equal to 3 digits in binary number, we can change binary number to octal number easily.

e.g. 10010 = 010010

2 2

Thus, 100102 = 228

Base Conversion
• e.g. convert 1810 in hexadecimal form
• Similarly, for hexadecimal form, one digit is equal to 4 digits in binary number.

e.g. 10010 = 00010010

1 2

Thus, 100102 = 1216

### Numbering System

• What is going on?
• 1 1 1 (carry)
• 3 7 5 8
• + 4 6 5 7
• 14 11 15
• 10 10 10 (subtract the base)
• 8 4 1 5

111

3758

+ 4657

8415

Rules.

• 0 + 0 = 0
• 0 + 1 = 1
• 1 + 0 = 1
• 1 + 1 = 2 = 102 = 0 with 1 to carry
• 1 + 1 + 1 = 3 = 112 = 1 with 1 to carry
• Verification
• 5510
• + 2810
• 8310
• 64 32 16 8 4 2 1
• 1 0 1 0 0 1 1
• = 64 + 16 + 2 +1
• = 8310

1 1 1 1

1 1 0 1 1 1

+ 0 1 1 1 0 0

2 3 2 2

- 2 2 2 2

1 0 1 0 0 1 1

ex Verification

1 0 0 1 1 1

+ 0 1 0 1 1 0 + ___

___________

128 64 32 16 8 4 2 1

=

=

1 1

6 4 3 78

+ 2 5 1 08

9 9

- 8 8 (subtract Base (8))

1 1 1 4 78

ex

3 5 3 68

+ 2 4 5 78

- (subtract Base (8))

1 1

7 C 3 916

+ 3 7 F 216

20 18 11

- 16 16 (subtract Base (16))

B 4 2 B16

8 A D 416

+ 5 D 616

- (subtract Base (16))

16

Decimal Subtraction

7 13 10

8 4 1 15

- 4 6 5 7

3 7 5 8

• How it was done?
• ( add the base 10 when borrowing)
• 1010
• 73010
• 8 41 5131015
• - 4 6 5 7
• 3 7 5 8
Binary Subtraction
• Verification
• 8310
• - 2810
• 5510
• 64 32 16 8 4 2 1
• 1 1 0 1 1 1
• = 32 + 16 + + 4 + 2 +1
• = 5510

1 2 1

02 0 2 2

1 0 1 0 0 1 1

- 0 1 1 1 0 0

1 1 0 1 1 1

Binary Subtraction

ex Verification

1 0 0 1 1 1

- 0 1 0 1 1 0 - ___

___________

128 64 32 16 8 4 2 1

=

=

Octal Subtraction

8

0 0 8

1 11 4 78

89

- 6 4 3 78

2 5 1 08

Octal Subtraction

ex

3 5 3 68

- 2 4 5 78

B 16

7 C 3 916

19

- 3 7 F 216

4 4 4 716