1 / 29

Numbering System

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?.

alan-brooks
Download Presentation

Numbering System

An Image/Link below is provided (as is) to download presentation 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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Numbering System Base Conversion

  2. 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

  3. 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

  4. 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

  5. Base Conversion • Conversion • Binary number, • Octal number, • Hexadecimal number, and • Decimal number.

  6. Base Conversion

  7. Base Conversion For example: 62 = 111110 = 76 = 3E decimal binary octal hexadecimal 1 For Decimal: 62 = 6x101 + 2x100 2 For Binary: 111110 = 1x25 + 1x24 + 1x23 + 1x22 + 1x21 + 0x20 3 For Octal: 76 = 7x81+ 6x80 4 For Hexadecimal: 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.

  8. 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

  9. Octal and Hexadecimal system • 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 • Hexadecimal to binary • Every one hexadecimal digit equivalent to 4 binary digits

  10. 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

  11. 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

  12. 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

  13. Numbering System Addition & Subtraction

  14. Decimal Addition • 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

  15. Binary Addition 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

  16. Binary Addition • 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

  17. Binary Addition ex Verification 1 0 0 1 1 1 + 0 1 0 1 1 0 + ___ ___________ 128 64 32 16 8 4 2 1 = =

  18. Octal Addition 1 1 6 4 3 78 + 2 5 1 08 9 9 - 8 8 (subtract Base (8)) 1 1 1 4 78

  19. Octal Addition ex 3 5 3 68 + 2 4 5 78 - (subtract Base (8))

  20. Hexadecimal Addition 1 1 7 C 3 916 + 3 7 F 216 20 18 11 - 16 16 (subtract Base (16)) B 4 2 B16

  21. Hexadecimal Addition 8 A D 416 + 5 D 616 - (subtract Base (16)) 16

  22. 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

  23. 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

  24. Binary Subtraction ex Verification 1 0 0 1 1 1 - 0 1 0 1 1 0 - ___ ___________ 128 64 32 16 8 4 2 1 = =

  25. Octal Subtraction 8 0 0 8 1 11 4 78 89 - 6 4 3 78 2 5 1 08

  26. Octal Subtraction ex 3 5 3 68 - 2 4 5 78

  27. Hexadecimal Subtraction B 16 7 C 3 916 19 - 3 7 F 216 4 4 4 716

  28. Hexadecimal Subtraction 8 A D 416 - 5 D 616 16

  29. Let’s do some exercises! Octal, Hexadecimal, Binary Addition & Subtraction

More Related