Download presentation
Presentation is loading. Please wait.
1
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
2
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
3
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: 111 2 = 7 8
4
Binary to Octal Relationship: OctalBinary 0000 1001 2010 3011 4100 5101 6110 7111 Does this table look familiar?
5
Practical Example applying octal values of rwx the chmod command (e.g., chmod 751). chmod 777 chmod 755 chmod 711 chmod 644
6
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: 1111 2 = F 16
7
Binary to Hexadecimal Relationship: HexadecimalBinary 0000081000 1000191001 20010A1010 30011B1011 40100C1100 50101D1101 60110E1110 70111F1111
8
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)
9
Convert Hex to Binary 11F6 16 = 1 1 F 6 =000(1) 000(1) (8)(4)(2)(1) 0(4)(2)0 =1 0001 1111 0110 =1000111110110 2 000 Drop Leading zeros
10
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
11
Convert Binary to Hex 1000111110110 2 =1 0001 1111 0110 =0001 0001 1111 0110 =1 1 (8)(4)(2)(1) 0(4)(2)0 =1 1 15 6 =11F6 16
12
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
13
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)
14
Data Formats Unsigned Binary Data stored as a binary number, with no way to express a negative quantity
15
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
16
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
17
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
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.