Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer...
-
Upload
neil-booth -
Category
Documents
-
view
221 -
download
0
Transcript of Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer...
![Page 1: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/1.jpg)
Computer Science
Introduction to the Number Base Unit
Adapted from Slides by John Owen
Computer Science Instructor, Rockport-Fulton High School,
Rockport, Texas
![Page 2: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/2.jpg)
John Owen, Rockport Fulton HS 2
Objective
This unit of study is designed to introduce the beginner computer science students to the concept of the computer number bases (2, 8, and 16) and their computation.
![Page 3: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/3.jpg)
John Owen, Rockport Fulton HS 3
Part1
Different Number Bases, specifically about those used by the computer
includes: Base Two – binary Base Eight – octal Base Sixteen – hexadecimal
![Page 4: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/4.jpg)
John Owen, Rockport Fulton HS 4
Base Ten
“because it has ten counting digits, 0,1,2,3,4,5,6,7,8, and 9”
To count in base ten, you go from 0 to 9, then do combinations of two digits starting with 10 all the way to 99
![Page 5: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/5.jpg)
John Owen, Rockport Fulton HS 5
Base Two
To count in base two, which only has 0 and 1 as counting digits, you count 0,1, then switch to two digit combinations, 10,11, then to three digit combos, 100, 101,110,111, then four digit, 1000, _____,_______, …, 1111
![Page 6: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/6.jpg)
John Owen, Rockport Fulton HS 6
Base Three
To count in base three, which has 0, 1, and 2 as counting digits, you count 0,1,2, then switch to two digit combinations, 10,11, 12, 20, 21, 22, then to three digit combos, 100, 101,102, 110,111, 112, etc…
![Page 7: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/7.jpg)
John Owen, Rockport Fulton HS 7
Base Eight
base eight (often called octal)… The base eight counting
sequence 0,1,2,3,4,5,6,7,10,11,12,13,…77
100,101,102,103,104,105,106,107110,111, etc.
![Page 8: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/8.jpg)
John Owen, Rockport Fulton HS 8
Base Sixteen
Base Sixteen, also known as hexadecimal, was especially created by computer scientists to help simplify low-level programming, like machine language and assembly language.
![Page 9: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/9.jpg)
John Owen, Rockport Fulton HS 9
Base Sixteen
To get sixteen counting digits, you use 0-9, but still need six more…so it was decided to use A,B,C,D,E, and F.
0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F Then the two-digit combos:10,11,12,…
19,1A,1B,1C,1D,1E,1F,20,21,22,…2D,2E,2F,30,31,…FF
![Page 10: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/10.jpg)
John Owen, Rockport Fulton HS 10
Base conversion
To convert from base ten to another base, such as base two, eight, or sixteen, is an important skill for computer scientists and programmers.
![Page 11: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/11.jpg)
John Owen, Rockport Fulton HS 11
Base Ten to Base Two
Let’s take the value 27 and convert it into base 2.
Here’s the process: Divide 27 by 2 The answer is 13, remainder 1 Divide 13 by 2 Answer is 6, remainder 1
![Page 12: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/12.jpg)
John Owen, Rockport Fulton HS 12
Base Ten to Base Two
Continue until the answer is 1. 6 divided by 2 = 3, remainder 0 3 divided by 2 = 1, remainder 1
Now take the last answer, 1, and all of the remainders in reverse order, and put them together…11011
27 base 10 = 11011 base two
![Page 13: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/13.jpg)
John Owen, Rockport Fulton HS 13
Base Ten to Base Two
Here’s an easy way to do it on paper
27 divided by 2 = 13, R 1
![Page 14: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/14.jpg)
John Owen, Rockport Fulton HS 14
Base Ten to Base Two
13 / 2 = 6, R 1
![Page 15: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/15.jpg)
John Owen, Rockport Fulton HS 15
Base Ten to Base Two
6 / 2 = 3, R 0
![Page 16: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/16.jpg)
John Owen, Rockport Fulton HS 16
Base Ten to Base Two
3 / 2 = 1, R 1
![Page 17: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/17.jpg)
John Owen, Rockport Fulton HS 17
Base Ten to Base Two
Stop, and write the answer
![Page 18: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/18.jpg)
John Owen, Rockport Fulton HS 18
Base Ten to Base Two
![Page 19: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/19.jpg)
John Owen, Rockport Fulton HS 19
Exercises
Now try a few yourself (see last slide for answers):
1. 1610 = _________2
2. 4710 = _________2
3. 14510 = _________2
4. 3110 = _________2
5. 3210 = _________2
![Page 20: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/20.jpg)
John Owen, Rockport Fulton HS 20
Base Ten to Base Eight
Let’s again take the value 27 and convert it into base 8.
Same process: Divide 27 by 8 The answer is 3, remainder 3 Stop! You can’t divide anymore
because the answer is less than 8
![Page 21: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/21.jpg)
John Owen, Rockport Fulton HS 21
Base Ten to Base Eight
The last answer was 3, and the only remainder was 3, so the base eight value is 33, base 8.
![Page 22: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/22.jpg)
John Owen, Rockport Fulton HS 22
Base Ten to Base Eight
Use the same method on paper
27 divided by 8 = 3, R 3 27, base 10 = 33, base 8
![Page 23: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/23.jpg)
John Owen, Rockport Fulton HS 23
Exercises
Now try the same values for base eight.
6. 1610 = _________8
7. 4710 = _________8
8. 14510 = _________8
9. 3110 = _________8
10. 3210 = _________8
![Page 24: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/24.jpg)
John Owen, Rockport Fulton HS 24
Base Ten to Base Sixteen
Finally we’ll convert 27 into base 16. Divide 27 by 16 The answer is 1, remainder 11 Stop! You can’t divide anymore
because the answer is less than 16
![Page 25: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/25.jpg)
John Owen, Rockport Fulton HS 25
Base Ten to Base Sixteen
The last answer was 1, and the only remainder was 11, which in base 16 is the letter B, so the base sixteen value is 1B, base 16.
![Page 26: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/26.jpg)
John Owen, Rockport Fulton HS 26
Base Ten to Base Sixteen
Again, the same method on paper
27 divided by 16 = 1, R 11 or B 27, base 10 = 1B, base 16
![Page 27: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/27.jpg)
John Owen, Rockport Fulton HS 27
Exercises
And now try base sixteen!
11. 1610 = _________16
12. 4710 = _________16
13. 14510 = _________16
14. 3110 = _________16
15. 3210 = _________16
![Page 28: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/28.jpg)
John Owen, Rockport Fulton HS 28
Here are the answers to the exercises, in jumbled order
10 1F 20 20 2F 37 40 57 91 221 1000011111 101111 100000
10010001
![Page 29: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/29.jpg)
John Owen, Rockport Fulton HS 29
Part 2: Other conversions
Now you will learn other conversions among these four number systems, specifically: Binary to Decimal Octal to Decimal Hexadecimal to Decimal
![Page 30: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/30.jpg)
John Owen, Rockport Fulton HS 30
Other conversions
As well as Binary to Octal Octal to Binary Binary to Hexadecimal Hexadecimal to Binary
Octal to Hexadecimal Hexadecimal to Octal
![Page 31: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/31.jpg)
John Owen, Rockport Fulton HS 31
Binary to Decimal
Each binary digit in a binary number has a place value.
In the number 111, base 2, the digit farthest to the right is in the “ones” place, like the base ten system, and is worth 1.
Technically this is the 20 place.
![Page 32: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/32.jpg)
John Owen, Rockport Fulton HS 32
Binary to Decimal
The 2nd digit from the right, 111, is in the “twos” place, which could be called the “base” place, and is worth 2.
Technically this is the 21 place. In base ten, this would be the
“tens” place and would be worth 10.
![Page 33: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/33.jpg)
John Owen, Rockport Fulton HS 33
Binary to Decimal
The 3rd digit from the right, 111, is in the “fours” place, or the “base squared” place, and is worth 4.
Technically this is the 22 place. In base ten, this would be the
“hundreds” place and would be worth 100.
![Page 34: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/34.jpg)
John Owen, Rockport Fulton HS 34
Binary to Decimal
The total value of this binary number, 111, is 4+2+1, or seven.
In base ten, 111 would be worth 100 + 10 + 1, or one-hundred eleven.
![Page 35: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/35.jpg)
John Owen, Rockport Fulton HS 35
Binary to Decimal
Can you figure the decimal values for these binary values? 11 101 110 1111 11011
![Page 36: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/36.jpg)
John Owen, Rockport Fulton HS 36
Binary to Decimal
answers: 11 is 3 in base ten 101 is 5 110 is 6 1111 is 15 11011 is 27
![Page 37: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/37.jpg)
John Owen, Rockport Fulton HS 37
Octal to Decimal
Octal digits have place values based on the value 8.
In the number 111, base 8, the digit farthest to the right is in the “ones” place and is worth 1.
Technically this is the 80 place.
![Page 38: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/38.jpg)
John Owen, Rockport Fulton HS 38
Octal to Decimal
The 2nd digit from the right, 111, is in the “eights” place, the “base” place, and is worth 8.
Technically this is the 81 place.
![Page 39: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/39.jpg)
John Owen, Rockport Fulton HS 39
Octal to Decimal
The 3rd digit from the right, 111, is in the “sixty-fours” place, the “base squared” place, and is worth 64.
Technically this is the 82 place.
![Page 40: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/40.jpg)
John Owen, Rockport Fulton HS 40
Octal to Decimal
The total value of this octal number, 111, is 64+8+1, or seventy-three.
![Page 41: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/41.jpg)
John Owen, Rockport Fulton HS 41
Octal to Decimal
Can you figure the value for these octal values? 21 156 270 1164 2105
![Page 42: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/42.jpg)
John Owen, Rockport Fulton HS 42
Octal to Decimal
Here are the answers: 21 is 17 in base 10 156 is 110 270 is 184 1164 is 628 2105 is 1093
![Page 43: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/43.jpg)
John Owen, Rockport Fulton HS 43
Hexadecimal to Decimal
Hexadecimal digits have place values base on the value 16.
In the number 111, base 16, the digit farthest to the right is in the “ones” place and is worth 1.
Technically this is the 160 place.
![Page 44: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/44.jpg)
John Owen, Rockport Fulton HS 44
Hexadecimal to Decimal
The 2nd digit from the right, 111, is in the “sixteens” place, the “base” place, and is worth 16.
Technically this is the 161
place.
![Page 45: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/45.jpg)
John Owen, Rockport Fulton HS 45
Hexadecimal to Decimal
The 3rd digit from the right, 111, is in the “two hundred fifty-six” place, the “base squared” place, and is worth 256.
Technically this is the 162
place.
![Page 46: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/46.jpg)
John Owen, Rockport Fulton HS 46
Hexadecimal to Decimal
The total value of this hexadecimal number, 111, is 256+16+1, or two hundred seventy-three.
![Page 47: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/47.jpg)
John Owen, Rockport Fulton HS 47
Hexadecimal to Decimal
Can you figure the value for these hexadecimal values? 2A 15F A7C 11BE A10D
![Page 48: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/48.jpg)
John Owen, Rockport Fulton HS 48
Hexadecimal to Decimal
Here are the answers: 2A is 42 in base 10 15F is 351 A7C is 2684 11BE is 4542 A10D is 41229
![Page 49: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/49.jpg)
John Owen, Rockport Fulton HS 49
Binary to Octal
The conversion between binary and octal is quite simple.
Since 2 to the power of 3 equals 8, it takes 3 base 2 digits to combine to make a base 8 digit.
![Page 50: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/50.jpg)
John Owen, Rockport Fulton HS 50
Binary to Octal 000 base 2 equals 0 base 8 0012 = 18
0102 = 28
0112 = 38
1002 = 48
1012 = 58
1102 = 68
1112 = 78
![Page 51: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/51.jpg)
John Owen, Rockport Fulton HS 51
Binary to Octal
What if you have more than three binary digits, like 110011?
Just separate the digits into groups of three from the right, then convert each group into the corresponding base 8 digit.
110 011 base 2 = 63 base 8
![Page 52: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/52.jpg)
John Owen, Rockport Fulton HS 52
Binary to Octal
Try these: 111100 100101 111001 1100101
Hint: when the leftmost group has fewer than three digits, fill with zeroes from the left:
1100101 = 1 100 101 = 001 100 101
110011101
![Page 53: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/53.jpg)
John Owen, Rockport Fulton HS 53
Binary to Octal
The answers are: 1111002 = 748
1001012 = 458
1110012 = 718
11001012 = 1458
1100111012 = 6358
![Page 54: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/54.jpg)
John Owen, Rockport Fulton HS 54
Binary to Hexadecimal
The conversion between binary and hexadecimal is equally simple.
Since 2 to the power of 4 equals 16, it takes 4 base 2 digits to combine to make a base 16 digit.
![Page 55: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/55.jpg)
John Owen, Rockport Fulton HS 55
Binary to Hexadecimal 0000 base 2 equals 0 base 8 00012 = 116
00102 = 216
00112 = 316
01002 = 416
01012 = 516
01102 = 616
01112 = 716
![Page 56: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/56.jpg)
John Owen, Rockport Fulton HS 56
Binary to Hexadecimal 10002 = 816
10012 = 916
10102 = A16
10112 = B16
11002 = C16
11012 = D16
11102 = E16
11112 = F16
![Page 57: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/57.jpg)
John Owen, Rockport Fulton HS 57
Binary to Hexadecimal
If you have more than four binary digits, like 11010111, again separate the digits into groups of four from the right, then convert each group into the corresponding base 16 digit.
1101 0111 base 2 = D7 base 16
![Page 58: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/58.jpg)
John Owen, Rockport Fulton HS 58
Binary to Hexadecimal
Try these: 11011100 10110101 10011001 110110101
Hint: when the leftmost group has fewer than four digits, fill with zeroes on the left:
110110101 = 1 1011 0101 = 0001 1011 0101
1101001011101
![Page 59: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/59.jpg)
John Owen, Rockport Fulton HS 59
Binary to Hexadecimal
The answers are: 110111002 = DC16
101101012 = B516
100110012 = 9916
1101101012 = 1B516
1 1010 0101 11012 = 1A5D16
![Page 60: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/60.jpg)
John Owen, Rockport Fulton HS 60
Octal to Binary
Converting from Octal to Binary is just the inverse of Binary to Octal.
For each octal digit, translate it into the equivalent three-digit binary group.
For example, 45 base 8 equals 100101 base 2
![Page 61: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/61.jpg)
John Owen, Rockport Fulton HS 61
Hexadecimal to Binary
Converting from Hexadecimal to Binary is the inverse of Binary to Hexadecimal.
For each “hex” digit, translate it into the equivalent four-digit binary group.
For example, 45 base 16 equals 01000101 base 2
![Page 62: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/62.jpg)
John Owen, Rockport Fulton HS 62
Octal and Hexadecimal to Binary Exercises
Convert each of these to binary: 638
12316
758
A2D16
218
3FF16
![Page 63: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/63.jpg)
John Owen, Rockport Fulton HS 63
Octal and Hexadecimal to Binary Exercises
The answers are: 638 = 1100112
12316 = 1001000112 (drop leading 0s)
758 = 1111012
A2D16 = 1100001011012
218 = 100012
3FF16 = 11111111112
![Page 64: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/64.jpg)
John Owen, Rockport Fulton HS 64
Hexadecimal to Octal
Converting from Hexadecimal to Octal is a two-part process.
First convert from “hex” to binary, then regroup the bits from groups of four into groups of three.
Then convert to an octal number.
![Page 65: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/65.jpg)
John Owen, Rockport Fulton HS 65
Hexadecimal to Octal
For example: 4A316 = 0100 1010 00112 = 010 010 100 0112
= 22438
![Page 66: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/66.jpg)
John Owen, Rockport Fulton HS 66
Octal to Hexadecimal
Converting from Octal to Hexadecimal is a similar two-part process.
First convert from octal to binary, then regroup the bits from groups of three into groups of four.
Then convert to an hex number.
![Page 67: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/67.jpg)
John Owen, Rockport Fulton HS 67
Hexadecimal to Octal
For example: 3718 = 011 111 0012 = 1111 10012
= F98
![Page 68: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/68.jpg)
John Owen, Rockport Fulton HS 68
Octal/Hexadecimal Practice
Convert each of these: 638 = ________16
12316 = ________8
758 = ________16
A2D16 = ________8
218 = ________16
3FF16 = ________8
![Page 69: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/69.jpg)
John Owen, Rockport Fulton HS 69
Octal/Hexadecimal Practice
The answers are 638 = 3316
12316 = 4438
758 = 3D16
A2D16 = 50558
218 = 1116
3FF16 = 17778
![Page 70: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/70.jpg)
John Owen, Rockport Fulton HS 70
Part3: Counting, Place Value
An introduction to the basic idea of counting in different bases and the place value system, associating it with the familiar base 10 system.
![Page 71: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/71.jpg)
John Owen, Rockport Fulton HS 71
Review Base Ten Addition, #1
In Base 10 addition, you learned a very simple process.
Look at this problem: 12
+37 First add the ones column,
then the tens.
![Page 72: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/72.jpg)
John Owen, Rockport Fulton HS 72
Review Base Ten Addition, #1
12
+37
49
The answer is 49…simple, right?
![Page 73: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/73.jpg)
John Owen, Rockport Fulton HS 73
Review Base Ten Addition, #2
Now look at this problem: 13 +37 When you add the ones
column values, the result of 10 EQUALS the base value of 10, so you have to CARRY a 1.
![Page 74: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/74.jpg)
John Owen, Rockport Fulton HS 74
Review Base Ten Addition, #2
1 13 +37 0 When a carry is made, you essentially
divide by 10 (the base) to determine what value to carry, and mod by 10 to determine what value to leave behind.
![Page 75: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/75.jpg)
John Owen, Rockport Fulton HS 75
Review Base Ten Addition,#2
1 13 +37 0 3 plus 7 is 10 10 divided by 10 is 1 (carry) 10 mod 10 is 0 (leave)
![Page 76: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/76.jpg)
John Owen, Rockport Fulton HS 76
Review Base Ten Addition, #2
1 13 +37 50
Answer is 50
![Page 77: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/77.jpg)
John Owen, Rockport Fulton HS 77
Review Base Ten Addition, #3
Here’s a third example: 16 +37 When you add the ones
column values, the result of 13 EXCEEDS the base value of 10, so CARRY a 1.
![Page 78: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/78.jpg)
John Owen, Rockport Fulton HS 78
Review Base Ten Addition, #3
16 +37 6 plus 7 is 13 13 divided by 10 is 1 (carry) 13 mod 10 is 3 (leave)
![Page 79: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/79.jpg)
John Owen, Rockport Fulton HS 79
Review Base Ten Addition, #3
1 16 +37 53 Answer is 53
![Page 80: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/80.jpg)
John Owen, Rockport Fulton HS 80
Review Base Ten Addition, #4
And finally, a fourth example: 76 +35 The ones column result of 11
EXCEEDS the base value of 10, and you CARRY a 1.
![Page 81: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/81.jpg)
John Owen, Rockport Fulton HS 81
Review Base Ten Addition,#4
1 76 +35 1 6 plus 5 is 11 11 divided by 10 is 1 (carry) 11 mod 10 is 1 (leave)
![Page 82: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/82.jpg)
John Owen, Rockport Fulton HS 82
Review Base Ten Addition, #4
1 76 +35 1 1+7+3 is 6 plus 5, which equals
11 11 divided by 10 is 1 (carry) 11 mod 10 is 1 (leave)
![Page 83: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/83.jpg)
John Owen, Rockport Fulton HS 83
Review Base Ten Addition, #4
1 76 +35 111 Answer is 111, base 10
![Page 84: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/84.jpg)
John Owen, Rockport Fulton HS 84
Base Eight Addition, #1
Now here is an example in base eight:
12 +34 When you add the ones column
values, the answer is 6, and the second column answer is 4.
![Page 85: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/85.jpg)
John Owen, Rockport Fulton HS 85
Base Eight Addition. #1
12 +34 48 Answer is 48, base eight You say, “four eight base eight”,
not “forty-eight” The phrase “forty-eight” is meant
for base ten only.
![Page 86: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/86.jpg)
John Owen, Rockport Fulton HS 86
Base Eight Addition, #2
Now look at this problem: 14 +34 When you add the ones
column values, the result of 8 EQUALS the base value of 8, and you have to CARRY a one.
![Page 87: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/87.jpg)
John Owen, Rockport Fulton HS 87
Base Eight Addition, #2
14 +34 Again you divide by 8 (the base)
to determine what value to carry, and mod by 8 to determine what value to leave behind.
![Page 88: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/88.jpg)
John Owen, Rockport Fulton HS 88
Base Eight Addition, #2
1 14 +34 0 4 plus 4 is 8 8 divided by 8 is 1 (carry) 8 mod 8 is 0 (leave)
![Page 89: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/89.jpg)
John Owen, Rockport Fulton HS 89
Base Eight Addition, #2
1 14 +34 50 Answer is “five zero, base
eight”! Looks strange, but it is correct!
![Page 90: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/90.jpg)
John Owen, Rockport Fulton HS 90
Base Eight Addition, #3
Here’s a third example: 16 +37 When you add the ones
column values, the result of 13 EXCEEDS the base value of 8, and you have to CARRY a one.
![Page 91: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/91.jpg)
John Owen, Rockport Fulton HS 91
Base Eight Addition, #3
1 16 +37 5 6 plus 7 is 13 13 divided by 8 is 1 (carry) 13 mod 8 is 5 (leave)
![Page 92: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/92.jpg)
John Owen, Rockport Fulton HS 92
Base Eight Addition, #3
1 16 +37 55 Answer is 55, base eight.
![Page 93: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/93.jpg)
John Owen, Rockport Fulton HS 93
Base Eight Addition, #4
And a fourth example: 76 +35 The ones column result of 11
EXCEEDS the base value of 8, …CARRY a one.
![Page 94: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/94.jpg)
John Owen, Rockport Fulton HS 94
Base Eight Addition, #4
1 76 +35 3 6 plus 5 is 11 11 divided by 8 is 1 (carry) 11 mod 8 is 3 (leave)
![Page 95: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/95.jpg)
John Owen, Rockport Fulton HS 95
Base Eight Addition, #4
1 76 +35 33 1+7+3 is 6 plus 5 is 11 11 divided by 8 is 1 (carry) 11 mod 8 is 3 (leave)
![Page 96: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/96.jpg)
John Owen, Rockport Fulton HS 96
Base Eight Addition, #4
1 76 +35 133Answer is 133, base 8
![Page 97: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/97.jpg)
John Owen, Rockport Fulton HS 97
Base Two Addition, #1
Base Two Addition is quite interesting, but also fairly simple.
Since the only counting digits in base two are the values 0 and 1, there are only a few situations you have to learn.
![Page 98: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/98.jpg)
John Owen, Rockport Fulton HS 98
Base Two Addition, #1
We’ll start simple: 1 +1 =10 (“one zero, base two”) This looks strange, but the
same process applies.
![Page 99: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/99.jpg)
John Owen, Rockport Fulton HS 99
Base Two Addition, #1
1 +1 = 10 Since 1 + 1 is 2, this EQUALS
the base value of 2, which means you carry the “div” answer and leave the “mod” answer
![Page 100: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/100.jpg)
John Owen, Rockport Fulton HS 100
Base Two Addition, #1
1 +1 = 10 2 / 2 = 1 (carry) 2 % 2 = 0 (leave) That’s it!
![Page 101: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/101.jpg)
John Owen, Rockport Fulton HS 101
Base Two Addition, #2
Here’s another: 10 +11 = 101 Can you figure it out?
![Page 102: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/102.jpg)
John Owen, Rockport Fulton HS 102
Base Two Addition, #2
10 +11 = 101 In the ones column, 1 + 0 is 1. In the second column, 1+1 is
2, or 10 in base 2
![Page 103: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/103.jpg)
John Owen, Rockport Fulton HS 103
Base Two Addition, #3
And another: 101101 +110011
= Can you figure it out?
![Page 104: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/104.jpg)
John Owen, Rockport Fulton HS 104
Base Two Addition, #3
Step by step… 1 101101 +110011 = 0
![Page 105: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/105.jpg)
John Owen, Rockport Fulton HS 105
Base Two Addition, #3
Step by step… 1 101101 +110011 = 00
![Page 106: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/106.jpg)
John Owen, Rockport Fulton HS 106
Base Two Addition, #3
Step by step… 1 101101 +110011 = 000
![Page 107: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/107.jpg)
John Owen, Rockport Fulton HS 107
Base Two Addition, #3
Step by step… 1 101101 +110011 = 0000
![Page 108: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/108.jpg)
John Owen, Rockport Fulton HS 108
Base Two Addition, #3
Step by step… 1 101101 +110011 = 00000 Since 1+1+1 is 3, carry 1 and
leave 1
![Page 109: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/109.jpg)
John Owen, Rockport Fulton HS 109
Base Two Addition, #3
Step by step… 1 101101 +110011 =1100000 All done!
![Page 110: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/110.jpg)
John Owen, Rockport Fulton HS 110
Base Sixteen, Example #1
In base sixteen, remember the digits are 0-9, then A-F, representing the values 0-15
Here’s an example: 29 +12
![Page 111: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/111.jpg)
John Owen, Rockport Fulton HS 111
Base Sixteen, Example #1
29 +12 = 3B, base 16 2 + 9 is 11, which is B in base
sixteen 2+1 is 3, so the answer is 3B
![Page 112: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/112.jpg)
John Owen, Rockport Fulton HS 112
Base Sixteen, Example #2
1 A9 +47 = F0, base 16 9+7 is 16, equal to the base,
so carry 1 and leave 0 1 + A(10) + 4 is 15, which is F
![Page 113: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/113.jpg)
John Owen, Rockport Fulton HS 113
Base Sixteen, Example #3
11 D6 +7C = 152, base 16 6+C(12) = 18, carry 1, leave 2 1+D(13)+7 = 21, carry 1, leave
5
![Page 114: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/114.jpg)
John Owen, Rockport Fulton HS 114
Base Sixteen, Example #4
11 EF +2D = 11C, base 16 F(15) + D(13) = 28, carry 1, leave
C(12) 1 + E(14) + 2 = 17, carry 1, leave 1
![Page 115: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/115.jpg)
John Owen, Rockport Fulton HS 115
Exercises
Now try these exercises1. 12 + 12 =
2. 78 + 68 =
3. F16 + F16 =
4. 58 + 58 =
5. 916 + B16 =
6. C16 + D16 =
![Page 116: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/116.jpg)
John Owen, Rockport Fulton HS 116
Exercises
7. 38 + 48 =
8. F16 + 216 =
9. 102 + 102 =
10. 12 + 10112 =
11. 102 + 1102 =
12. 2168 + 3648 =
13. 7778 + 38 =
![Page 117: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/117.jpg)
John Owen, Rockport Fulton HS 117
Exercises
14. ACE16 + BAD16 =
15. 23416 + 97516 =
16. 4216 + F16 + 87616 =
![Page 118: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/118.jpg)
John Owen, Rockport Fulton HS 118
ANSWERS (JUMBLED)
7 11 12 10 14 15 19
1E 100 602 BA9 8C71000
1002 1100 167B
![Page 119: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/119.jpg)
John Owen, Rockport Fulton HS 119
Part 4
In this section you’ll learn how to do subtraction and how to solve simple equations involving Base 2, 8, and 16.
Again, it is essentially the same concept as Base 10, just in a different base!
![Page 120: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/120.jpg)
John Owen, Rockport Fulton HS 120
Review Base Ten Subtraction
In Base 10 subtraction, you use a very simple process.
Look at this problem: 48 -37 = 11
![Page 121: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/121.jpg)
John Owen, Rockport Fulton HS 121
Review Base Ten Subtraction
48 -37 = 11 Each column is subtracted to
get an answer of 11…
![Page 122: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/122.jpg)
John Owen, Rockport Fulton HS 122
Subtraction, Base 10
Now look at this problem: 63 -37
In this problem, you need to borrow.
![Page 123: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/123.jpg)
John Owen, Rockport Fulton HS 123
Subtraction, Base 10
513 63 -37
Borrowing means taking a value from the next column and adding it to the column you need.
![Page 124: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/124.jpg)
John Owen, Rockport Fulton HS 124
Subtraction, Base 10
513 63 -37
In this case, borrow from the 6, which becomes five, and add 10 to the 3, making 13.
![Page 125: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/125.jpg)
John Owen, Rockport Fulton HS 125
Subtraction, Base 10
513 63 -37
When you borrow 1 from one column, it becomes the value of the base in the next column, or 10 in this case.
![Page 126: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/126.jpg)
John Owen, Rockport Fulton HS 126
Subtraction, Base 10
513 63 -37 26
Then you subtract the two columns with a result of 26.
![Page 127: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/127.jpg)
John Owen, Rockport Fulton HS 127
Subtraction, Base 8
Now let’s try base eight: 63 -37
Again, in this problem, you need to borrow.
![Page 128: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/128.jpg)
John Owen, Rockport Fulton HS 128
Subtraction, Base 8
511 63 -37
Borrow from the 6, which becomes five, and add 8 to the 3, making 11!
![Page 129: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/129.jpg)
John Owen, Rockport Fulton HS 129
Subtraction, Base 8
511 63 -37
When you borrow 1 from a column, it becomes the value of the base in the next column, or 8 in this case.
![Page 130: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/130.jpg)
John Owen, Rockport Fulton HS 130
Subtraction, Base 8
511 63 -37 24
Then you subtract the two columns with a result of 24, base 8.
![Page 131: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/131.jpg)
John Owen, Rockport Fulton HS 131
Subtraction, Base 16
Now base 16: 519 63 -37
Again, we borrow from the 6, which becomes five, and add 16 to the 3, making 19!
![Page 132: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/132.jpg)
John Owen, Rockport Fulton HS 132
Subtraction, Base 16
519 63 -37
When you borrow 1 from a column, it becomes the value of the base in the next column, or 16 in this case.
![Page 133: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/133.jpg)
John Owen, Rockport Fulton HS 133
Subtraction, Base 16
519 63 -37 2C In the ones column, 19 minus 7
is 12, which is C in base sixteen, with 2 in the second column.
![Page 134: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/134.jpg)
John Owen, Rockport Fulton HS 134
Subtraction, Base 16
Here’s another example in base 16
D6 -3B
How is this one solved? Try it.
![Page 135: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/135.jpg)
John Owen, Rockport Fulton HS 135
Subtraction, Base 16
C22 D6 -3B
We must borrow from D, which becomes C, then add 16 to 6, which makes 22.
![Page 136: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/136.jpg)
John Owen, Rockport Fulton HS 136
Subtraction, Base 16
C22 D6 -3B 9B
22 minus B (11) is B. C minus 3 is 9. Answer is 9B
![Page 137: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/137.jpg)
John Owen, Rockport Fulton HS 137
Subtraction, Base 2
Now base 2: 11 - 1 10 This one is easy…answer is 10
![Page 138: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/138.jpg)
John Owen, Rockport Fulton HS 138
Subtraction, Base 2
Another in base 2: 02 110 - 1 Here we need to borrow from
the twos place…
![Page 139: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/139.jpg)
John Owen, Rockport Fulton HS 139
Subtraction, Base 2
02 110 - 1 101Subtract to get the answer.
![Page 140: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/140.jpg)
John Owen, Rockport Fulton HS 140
Subtraction, Base 2
Still another in base 2: 02 110 - 11 1Now borrow again…
![Page 141: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/141.jpg)
John Owen, Rockport Fulton HS 141
Subtraction, Base 2
2 100 - 11 01Final answer is 01, base 2
![Page 142: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/142.jpg)
John Owen, Rockport Fulton HS 142
Simple Equations
Here an equation to solve (base 10):
x + 6 = 14
![Page 143: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/143.jpg)
John Owen, Rockport Fulton HS 143
Simple Equations
Solution…subtract 6 from both sides
x + 6 = 14 -6 -6x = 8
![Page 144: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/144.jpg)
John Owen, Rockport Fulton HS 144
Simple Equations
Now do it in base 8:
x + 6 = 14
![Page 145: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/145.jpg)
John Owen, Rockport Fulton HS 145
Simple Equations
Solution…subtract 6 from both sides
x + 6 = 14 -6 -6x = ?
![Page 146: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/146.jpg)
John Owen, Rockport Fulton HS 146
Simple Equations
Answer is 6, base 8 12x + 6 = 14 -6 -6x = 6
![Page 147: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/147.jpg)
John Owen, Rockport Fulton HS 147
Simple Equations
Here’s an equation in base sixteen (remember, A and F are NOT variables, but base sixteen values):
x + 2A = F3
![Page 148: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/148.jpg)
John Owen, Rockport Fulton HS 148
Simple Equations
Solution?
x + 2A = F3
![Page 149: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/149.jpg)
John Owen, Rockport Fulton HS 149
Simple Equations
Subtract 2A from both sides: E19x + 2A = F3 - 2A -2Ax = C9
![Page 150: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/150.jpg)
John Owen, Rockport Fulton HS 150
Exercises
Now try these exercises1. 12 - 12 =
2. 78 - 68 =
3. F16 - A16 =
4. 158 - 68 =
5. 4916 - 2B16 =
6. CC16 - AD16 =
![Page 151: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/151.jpg)
John Owen, Rockport Fulton HS 151
Exercises
7. 738 - 348 =
8. 3E16 – 2F16 =
9. 1012 - 102 =
10. 11012 - 112 =
11. 10102 - 1112 =
12. 7168 - 3648 =
13. 7768 + 3378 =
![Page 152: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/152.jpg)
John Owen, Rockport Fulton HS 152
Exercises
Now let’s mix it up a bit!14. AE16 + 768 = _________8
15. 2348 + 110110112 = _________16
16. 101102 - F16 + 768 = _________10
17. 38 + 3910 - 1101012 = _________16
18. 11112 - F16 + 1510 = _________16
![Page 153: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/153.jpg)
John Owen, Rockport Fulton HS 153
Exercises
And finally, some equations19. x16 + 7616 = AB16
20. x2 - 10112 = 1012
21. x8 + 568 = 728
22. x2 + 2510 = 1F16
23. x8 + 3748 - 65568 = BAD16
24. 378 + X16 = 110111102
![Page 154: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/154.jpg)
John Owen, Rockport Fulton HS 154
ANSWERS (JUMBLED)35
37
69
110
177
332
354
1010
0
1
5
7
11
11
14
19
1335
10000
14037
1E
1F
BF
F
F
![Page 155: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/155.jpg)
155
Representing Fractional Numbers
Computers store fractional numbers Negative and positive
Storage technique based on floating-point notation Example: 1.345E+5 1.345 = mantissa, E = exponent, + 5 moves
decimal IEEE-754 specification
Uses binary mantissas and exponents Implementation details are part of
advanced study
![Page 156: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/156.jpg)
Conversion to Decimal (dn…..d2 d1 d0 . d-1 d-2 ……) R = ( )10
![Page 157: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/157.jpg)
Examples
![Page 158: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/158.jpg)
Example
![Page 159: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/159.jpg)
Part5:Data Representation in Binary
Binary values map to two states On or off
Bit Each 1 and 0 (on and off ) in a computer
Byte Group of 8 bits
Word Collection of bytes (typically 4 bytes)
Nibble Half a byte or 4 bits
Connecting with Computer Science, 2e 159
![Page 160: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/160.jpg)
Representing Whole Numbers
Whole numbers (integer numbers) Stored in fixed number of bits 2010 stored as 16-bit integer 0000011111011010
Equivalent hex value: 07DA Signed numbers stored with twos
complement Leftmost bit reserved for sign
1 = negative and 0 = positive If positive: leave as is If negative: perform twos complement
Reverse bit pattern and add 1 to number using binary addition
160
![Page 161: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/161.jpg)
161
Figure 7-5, Storing numbers in a twos complement 8-bit field
Representing Whole Numbers (cont’d.)
![Page 162: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/162.jpg)
One’s Complement
Way to represent negative values. Change every one in binary to zero
and every zero to 1
![Page 163: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/163.jpg)
Example
Convert (1010011)2 one’s complement. (0101100) 1’s
Convert (1000010011) which is one’s complement to its binary value. (0111101100)2
![Page 164: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/164.jpg)
Two’s complement It is a way to represent a number with
both value and sign. The most important property is that the
Most Significant Bit has a negative weight.
To convert from two’s complement to decimal is an easy way. The only difference is that during computation the weight of the last bit is negative.
![Page 165: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/165.jpg)
Example to convert from two’s complement to decimal.
![Page 166: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/166.jpg)
Converting from decimal number to two’s complement We have two cases.
If it is a positive decimal number. It is the same as normal binary except that you add 0 as MSB to the binary number.
If it is negative decimal number. Treat the number as if it is positive. Convert it to binary number. Put Zeroes to the left of the number. Convert the zero to one and one to zero for
all digits Add one to the whole number.
![Page 167: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/167.jpg)
Subtraction using two’s complement Subtraction process requires two operands:
minuend and subtrahend, normally the subtrahend is greater than the minuend. Make sure you have more digits that
accommodate the value of the numbers by adding zeros to the left of the two numbers.
Convert the subtrahend to two’s complement. Add the two numbers. If the number of digits of the result exceeds
numbers of digits both numbers. Cancel that digit.
![Page 168: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/168.jpg)
Example of Two’s complement subtraction. Subtract 1001 from 101.
Number of digits ( we need 5 digits for those numbers) so , we add trailing zeros
Minuend becomes 00101 and the subtrahend becomes 01001
Convert the subtrahend to two’s complement So it 01001 becomes 10111
Add both numbers: 00101 to 10111 00101 +10111 = 11100
As the number of digits of the result is that same as the number of the digits of both number. This is the result.
(Note that as the last bit of the result is 1, it means the number is negative , to find its value. Follow the rules to convert from two’s complement to decimal)
![Page 169: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/169.jpg)
Example of Two’s complement subtraction. Subtract 110 from 1011.
Number of digits ( we need 5 digits for those numbers) so , we add trailing zeros
Minuend becomes 01011 and the subtrahend becomes 00110
Convert the subtrahend to two’s complement So it 00110 becomes 11010
Add both numbers: 01011 to 11010 01011+ 11010 = 100101
Because we have six digits, the left most digits is discarded and keep the number of the digits to 5. the result will b 00101
(Note that as the last bit of the result is 0, it means the number is positive, to find its value. Follow the rules to convert from two’s complement to decimal)
![Page 170: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/170.jpg)
John Owen, Rockport Fulton HS 170
Exercises 1-5
Convert each of these to base 2
1. 528
2. 2738
3. 6178
4. 44728
5. 35028
![Page 171: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/171.jpg)
John Owen, Rockport Fulton HS 171
Exercises 6 - 10
Convert each of these to base 2
6. 67316
7. 2A516
8. DEB16
9. 50C16
10. 293716
![Page 172: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/172.jpg)
John Owen, Rockport Fulton HS 172
Exercises 11 - 15
Convert each of these to base 2
11. 4510
12. 3610
13. 1710
14. 7210
15. 5710
![Page 173: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/173.jpg)
John Owen, Rockport Fulton HS 173
Exercises 16 - 20
Convert each of these to base 8
16. 1100112
17. 11110012
18. 100101102
19. 110110112
20. 1101001012
![Page 174: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/174.jpg)
John Owen, Rockport Fulton HS 174
Exercises 21 - 25
Convert each of these to base 8
21. 45316
22. D1016
23. 72916
24. BCEF16
25. 4A616
![Page 175: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/175.jpg)
John Owen, Rockport Fulton HS 175
Exercises 26 - 30
Convert each of these to base 8
26. 4610
27. 8910
28. 7010
29. 12010
30. 27310
![Page 176: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/176.jpg)
John Owen, Rockport Fulton HS 176
Exercises 31 - 35
Convert each of these to base 16
31. 1011012
32. 11100012
33. 110011012
34. 10001001012
35. 11000010012
![Page 177: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/177.jpg)
John Owen, Rockport Fulton HS 177
Exercises 36 - 40
Convert each of these to base 16
36. 468
37. 2768
38. 7258
39. 56248
40. 70138
![Page 178: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/178.jpg)
John Owen, Rockport Fulton HS 178
Exercises 41 - 45
Convert each of these to base 16
41. 7410
42. 15610
43. 16810
44. 41510
45. 55010
![Page 179: Computer Science Introduction to the Number Base Unit Adapted from Slides by John Owen Computer Science Instructor, Rockport-Fulton High School, Rockport,](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfb91a28abf838c9fb65/html5/thumbnails/179.jpg)
John Owen, Rockport Fulton HS 179
ANSWERS…JUMBLED!
26
56
63
71
106
131
170
171
225
6420
10001
100100
101010
101101
111001
136357
10010000
10111011
226
226
309
333
421
645
2123
2246
3451
110001111
1010100101
10100001100
11001110011
11101000010
100100111010
110111101011
10100100110111
19F
1D5
2D
4A
9C
A8
B94
BE
CD
EOB