dale & lewis chapter 2 binary numbers and number systems
DESCRIPTION
Dale & Lewis Chapter 2 Binary Numbers and Number Systems. Number categories. Definition of Number Unit of a mathematical system subject to arithmetic Natural numbers 0, 1, 2, 3, 4… Negative numbers Number less then 0, i.e. -1, -2, -3, -4… Integers …-4, -3, -2, -1, 0, 1, 2, 3, 4… - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Dale & Lewis Chapter 2 Binary Numbers and Number Systems](https://reader035.vdocument.in/reader035/viewer/2022081511/568138e7550346895da0998f/html5/thumbnails/1.jpg)
Dale & Lewis Chapter 2Binary Numbers and Number Systems
![Page 2: Dale & Lewis Chapter 2 Binary Numbers and Number Systems](https://reader035.vdocument.in/reader035/viewer/2022081511/568138e7550346895da0998f/html5/thumbnails/2.jpg)
Number categories• Definition of
− Number Unit of a mathematical system subject to arithmetic
− Natural numbers 0, 1, 2, 3, 4…
− Negative numbers Number less then 0, i.e. -1, -2, -3, -4…
− Integers …-4, -3, -2, -1, 0, 1, 2, 3, 4…
− Rational numbers Fraction of integers, except division by 0, i.e. ¼, ½, -7/13…
![Page 3: Dale & Lewis Chapter 2 Binary Numbers and Number Systems](https://reader035.vdocument.in/reader035/viewer/2022081511/568138e7550346895da0998f/html5/thumbnails/3.jpg)
The idea of a positional number system
4357 four thousand, three hundred and fifty seven
four units of a thousand (4 x 1000) 4000three units of a hundred (3 x 100) 300five units of ten (5 x 10) 50seven units of one (7 x 1) 7
4 x 103 + 3 x 102 + 5 x 101 + 7 x 100
5743 same digits, different positions, different number
The position of each digit determines that digit’s contribution to the number.
![Page 4: Dale & Lewis Chapter 2 Binary Numbers and Number Systems](https://reader035.vdocument.in/reader035/viewer/2022081511/568138e7550346895da0998f/html5/thumbnails/4.jpg)
The idea of a positional number system
base: b any integer > 1
digits: 0, 1, ..., b−1
number: dn-1dn-2…d2d1d0
its definition
dn-1 x bn-1 + dn-2 x bn-2 + … + d2 x b2 + d1 x b1 + d0 x b0
Examples:
Base Digits2 0, 15 0, 1, 2, 3, 48 0, 1, 2, 3, 4, 5, 6, 710 0, 1, 2, 3, 4, 5, 6, 7, 8, 916 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
![Page 5: Dale & Lewis Chapter 2 Binary Numbers and Number Systems](https://reader035.vdocument.in/reader035/viewer/2022081511/568138e7550346895da0998f/html5/thumbnails/5.jpg)
Binary, Octal and HexadecimalComparison of first natural numbers in four different bases
etc...
![Page 6: Dale & Lewis Chapter 2 Binary Numbers and Number Systems](https://reader035.vdocument.in/reader035/viewer/2022081511/568138e7550346895da0998f/html5/thumbnails/6.jpg)
…So what base was used in the data in the Matrix movies?
![Page 7: Dale & Lewis Chapter 2 Binary Numbers and Number Systems](https://reader035.vdocument.in/reader035/viewer/2022081511/568138e7550346895da0998f/html5/thumbnails/7.jpg)
Arithmetic in other basesAll the familiar rules of pencil-and-paper decimal arithmetic carry over to any other base
Addition
46 101110+ 27 + 11011
Subtraction
5037- 95
57 111001- 6 - 110
Decimal Grid
Binary Grid
![Page 8: Dale & Lewis Chapter 2 Binary Numbers and Number Systems](https://reader035.vdocument.in/reader035/viewer/2022081511/568138e7550346895da0998f/html5/thumbnails/8.jpg)
Octal Grid
Hexadecimal Grid
![Page 9: Dale & Lewis Chapter 2 Binary Numbers and Number Systems](https://reader035.vdocument.in/reader035/viewer/2022081511/568138e7550346895da0998f/html5/thumbnails/9.jpg)
Examples of arithmetic
In Octal:
3754 76312+6317 + 4634
In Hexadecimal:
3B6F 89FCD +5743 + 9FD
In Decimal:
123 + 45 +3682 + 12 + 654
![Page 10: Dale & Lewis Chapter 2 Binary Numbers and Number Systems](https://reader035.vdocument.in/reader035/viewer/2022081511/568138e7550346895da0998f/html5/thumbnails/10.jpg)
Conversion between Decimal and Binary
• Binary to Decimal− Use the definition of a number in a positional number
system with base 2− Evaluate the definition formula using decimal arithmetic
• Example
101011 = 1 x 25 + 0 x 24 + 1 x 23 + 0 x 22 + 1 x 21 + 1 x 20
= 43 (decimal)
![Page 11: Dale & Lewis Chapter 2 Binary Numbers and Number Systems](https://reader035.vdocument.in/reader035/viewer/2022081511/568138e7550346895da0998f/html5/thumbnails/11.jpg)
Conversion between Decimal and Binary• Decimal to Binary
− Repeatedly divide by 2− Quotient Carries− Remainder is the next digit− Binary number is developed right to left
• Example (Quotient) (Remainder) (Binary)
173 ÷ 2 86 1 1 86 ÷ 2 43 0 01 43 ÷ 2 21 1 101 21 ÷ 2 10 1 1101 10 ÷ 2 5 0 01101 5 ÷ 2 2 1 101101 2 ÷ 2 1 0 0101101 1 ÷ 2 0 1 10101101
![Page 12: Dale & Lewis Chapter 2 Binary Numbers and Number Systems](https://reader035.vdocument.in/reader035/viewer/2022081511/568138e7550346895da0998f/html5/thumbnails/12.jpg)
Generalization: Conversion between Decimal and base b
• Base b to Decimal− Use the definition of a number in a positional number
system with base b− Evaluate the definition formula using decimal arithmetic
• Decimal to base b− Repeatedly divide by b− Quotient carries− Remainder is the next digit− Base b number is developed right to left
![Page 13: Dale & Lewis Chapter 2 Binary Numbers and Number Systems](https://reader035.vdocument.in/reader035/viewer/2022081511/568138e7550346895da0998f/html5/thumbnails/13.jpg)
Conversion between Binary and Octal/Hexadecimal• Binary to Octal
− Group bits into threes, right to left− Convert each group into an octal digit
• Example
1011010111 = 001 011 010 111 = 1327 (octal)
• Binary to Hexadecimal− Group bits into fours, right to left− Convert each group into a hexadecimal digit
• Example
1011001011 = 0010 1100 1011 = 2CB (hexadecimal)
![Page 14: Dale & Lewis Chapter 2 Binary Numbers and Number Systems](https://reader035.vdocument.in/reader035/viewer/2022081511/568138e7550346895da0998f/html5/thumbnails/14.jpg)
Conversion between Binary and Octal/Hexadecimal
• Octal to Binary− Convert each digit to a three-bit binary representation
• Example
705 = 111 000 101 = 111000101 (binary)
• Hexadecimal to Binary− Convert each digit to a four-bit binary representation
• Example
10AF = 0001 0000 1010 1111= 0001000010101111 (binary)
Conversion tables can be reconstructed in the margins of a test paper when needed
![Page 15: Dale & Lewis Chapter 2 Binary Numbers and Number Systems](https://reader035.vdocument.in/reader035/viewer/2022081511/568138e7550346895da0998f/html5/thumbnails/15.jpg)
What about converting between Octal and Hexadecimal?
• Hexadecimal is not base 8, so grouping won’t work as in binary octal or binary hexadecimal
• Octal to Hexadecimal− Convert octal to binary and then binary to hexadecimal
• Hexadecimal to Octal− Convert hexadecimal to binary and then to octal
![Page 16: Dale & Lewis Chapter 2 Binary Numbers and Number Systems](https://reader035.vdocument.in/reader035/viewer/2022081511/568138e7550346895da0998f/html5/thumbnails/16.jpg)
![Page 17: Dale & Lewis Chapter 2 Binary Numbers and Number Systems](https://reader035.vdocument.in/reader035/viewer/2022081511/568138e7550346895da0998f/html5/thumbnails/17.jpg)
Decimal Binary Octal Hexadecimal
0 0 0 0
1 1 1 1
2 10 2 2
3 11 3 3
4 100 4 4
5 101 5 5
6 110 6 6
7 111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
16 10000 20 10
17 10001 21 11
18 10010 22 12
19 10011 23 13
20 10100 24 14
21 10101 25 15
22 10110 26 16
23 10111 27 17
![Page 18: Dale & Lewis Chapter 2 Binary Numbers and Number Systems](https://reader035.vdocument.in/reader035/viewer/2022081511/568138e7550346895da0998f/html5/thumbnails/18.jpg)
0 1 2 3 4 5 6 7 8 9
0 00 01 02 03 04 05 06 07 08 09
1 01 02 03 04 05 06 07 08 09 10
2 02 03 04 05 06 07 08 09 10 11
3 03 04 05 06 07 08 09 10 11 12
4 04 05 06 07 08 09 10 11 12 13
5 05 06 07 08 09 10 11 12 13 14
6 06 07 08 09 10 11 12 13 14 15
7 07 08 09 10 11 12 13 14 15 16
8 08 09 10 11 12 13 14 15 16 17
9 09 10 11 12 13 14 15 16 17 18
0 1
0 00 01
1 01 10
![Page 19: Dale & Lewis Chapter 2 Binary Numbers and Number Systems](https://reader035.vdocument.in/reader035/viewer/2022081511/568138e7550346895da0998f/html5/thumbnails/19.jpg)
0 1 2 3 4 5 6 7
0 00 01 02 03 04 05 06 07
1 01 02 03 04 05 06 07 10
2 02 03 04 05 06 07 10 11
3 03 04 05 06 07 10 11 12
4 04 05 06 07 10 11 12 13
5 05 06 07 10 11 12 13 14
6 06 07 10 11 12 13 14 15
7 07 10 11 12 13 14 15 16
![Page 20: Dale & Lewis Chapter 2 Binary Numbers and Number Systems](https://reader035.vdocument.in/reader035/viewer/2022081511/568138e7550346895da0998f/html5/thumbnails/20.jpg)
0 1 2 3 4 5 6 7 8 9 A B C D E F
0 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
1 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10
2 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11
3 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12
4 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13
5 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14
6 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15
7 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16
8 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17
9 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18
A 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19
B 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A
C 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B
D 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C
E 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D
F 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E