Agenda
-
Upload
megan-kerr -
Category
Documents
-
view
33 -
download
2
description
Transcript of Agenda
![Page 1: Agenda](https://reader036.fdocuments.us/reader036/viewer/2022082817/56812a52550346895d8d9ea1/html5/thumbnails/1.jpg)
Agenda
• Shortcuts converting among numbering systems– Binary to Hex / Hex to Binary– Binary to Octal / Octal to Binary
• Signed and unsigned binary numbers
• Addition / Subtraction of Binary Numbers
• Two’s Complement
![Page 2: Agenda](https://reader036.fdocuments.us/reader036/viewer/2022082817/56812a52550346895d8d9ea1/html5/thumbnails/2.jpg)
Numbering System Shortcuts
It is very simple to convert binary numbers to octal or hexadecimal numbers since 8 is 2^3, and 16 is 2^4
In other words:
• 1 Octal digit = 3 binary digits
• 1 Hex digit - 4 binary digits
![Page 3: Agenda](https://reader036.fdocuments.us/reader036/viewer/2022082817/56812a52550346895d8d9ea1/html5/thumbnails/3.jpg)
Binary to Octal
Notice the Pattern:• Largest 3 digit binary is 111
• 1 octal digit will represent a 3 digit binary number
• Highest Octal digit is 7
• Therefore: 1112 = 78
![Page 4: Agenda](https://reader036.fdocuments.us/reader036/viewer/2022082817/56812a52550346895d8d9ea1/html5/thumbnails/4.jpg)
Binary to Octal
Relationship:Octal Binary
0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111
Does this table look familiar?
![Page 5: Agenda](https://reader036.fdocuments.us/reader036/viewer/2022082817/56812a52550346895d8d9ea1/html5/thumbnails/5.jpg)
Practical Example
• applying octal values of rwx the chmod command (e.g., chmod 751).
• chmod 777
• chmod 755
• chmod 711
• chmod 644
![Page 6: Agenda](https://reader036.fdocuments.us/reader036/viewer/2022082817/56812a52550346895d8d9ea1/html5/thumbnails/6.jpg)
Binary to Hexadecimal
Notice the Pattern:• Largest 4 digit binary is 1111
• 1 hex digit will represent a 4 digit binary number
• Highest hex digit is F
• Therefore: 11112 = F16
![Page 7: Agenda](https://reader036.fdocuments.us/reader036/viewer/2022082817/56812a52550346895d8d9ea1/html5/thumbnails/7.jpg)
Binary to Hexadecimal
Relationship:Hexadecimal Binary Hexadecimal Binary
0 0000 8 1000
1 0001 9 1001
2 0010 A 1010
3 0011 B 1011
4 0100 C 1100
5 0101 D 1101
6 0110 E 1110
7 0111 F 1111
![Page 8: Agenda](https://reader036.fdocuments.us/reader036/viewer/2022082817/56812a52550346895d8d9ea1/html5/thumbnails/8.jpg)
Convert Hex to Binary
Steps:• Convert Hex number to groups of
powers of 2.
• Convert to Binary number (Remember to drop leading zeros for first set of binary numbers - i.e. first left set)
![Page 9: Agenda](https://reader036.fdocuments.us/reader036/viewer/2022082817/56812a52550346895d8d9ea1/html5/thumbnails/9.jpg)
Convert Hex to Binary
11F616
= 1 1 F 6
= 000(1) 000(1) (8)(4)(2)(1) 0(4)(2)0
= 1 0001 1111 0110= 10001111101102
000
Drop Leading zeros
![Page 10: Agenda](https://reader036.fdocuments.us/reader036/viewer/2022082817/56812a52550346895d8d9ea1/html5/thumbnails/10.jpg)
Convert Binary to Hex
Steps:• Separate into 4 bit groups starting from
the right.
• Calculate decimal equivalent (in placeholders in powers of 2)
• Convert to Hexadecimal number
![Page 11: Agenda](https://reader036.fdocuments.us/reader036/viewer/2022082817/56812a52550346895d8d9ea1/html5/thumbnails/11.jpg)
Convert Binary to Hex
10001111101102
=1 0001 1111 0110
=0001 0001 1111 0110= 1 1 (8)(4)(2)(1) 0(4)(2)0
= 1 1 15 6= 11F616
![Page 12: Agenda](https://reader036.fdocuments.us/reader036/viewer/2022082817/56812a52550346895d8d9ea1/html5/thumbnails/12.jpg)
Converting Octal to Hexadecimal
• The easiest method to convert between Octal and Hexadecimal is to convert to binary as an intermediate step
• Regroup binary in groups of 4 for hexadecimal and 3 for octal
![Page 13: Agenda](https://reader036.fdocuments.us/reader036/viewer/2022082817/56812a52550346895d8d9ea1/html5/thumbnails/13.jpg)
Storing Numbers
• Numeric information (stored as a non negative number) is often store in a computer in binary.
Eg.
• 1 byte (0 - 255 numbers)
• 2 bytes (0 - 65535)
• 4 bytes (0-4294967295)
![Page 14: Agenda](https://reader036.fdocuments.us/reader036/viewer/2022082817/56812a52550346895d8d9ea1/html5/thumbnails/14.jpg)
Data Formats
Unsigned Binary• Data stored as a binary number, with
no way to express a negative quantity
![Page 15: Agenda](https://reader036.fdocuments.us/reader036/viewer/2022082817/56812a52550346895d8d9ea1/html5/thumbnails/15.jpg)
Data Formats
Signed Binary• Data stored as a binary number, but
using a leading zero to represent a positive number, and the two’s complement of a binary number for a negative number
![Page 16: Agenda](https://reader036.fdocuments.us/reader036/viewer/2022082817/56812a52550346895d8d9ea1/html5/thumbnails/16.jpg)
Adding / Subtracting Binary Numbers
• Addition:0 + 0 = 0
0 + 1 = 1, 1 + 0 = 1
1 + 1+ = 10
• Subtraction:0 - 0 = 0
1 - 1 = 0, 1 - 0 = 1
0 - 1 (Must borrow from next placeholder)
Therefore 10 - 1 = 1
![Page 17: Agenda](https://reader036.fdocuments.us/reader036/viewer/2022082817/56812a52550346895d8d9ea1/html5/thumbnails/17.jpg)
Two’s Complement
• Simple method of subtracting two binary numbers by adding.
• Two Complement– Flip binary numbers (0 becomes 1, visa versa)– then add 1– Result becomes negative
• Therefore, short-hand method of representing negative integers