2's complement v2 - CIS 3360 Security in Computing Spring...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
CIS 3360 Security in Computing Spring 2010 Handout – Number Systems and Signed Arithmetic Decimal Number System In the decimal system (Base 10) that you are well familiar with, any number can be represented by a combination of any ten digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. Examples: 500, 32, 10, 54 Sometimes, when dealing with multiple bases, the subscript 10 is written with the decimal number. For example, 32 10 or 54 10 , etc. Binary Number System In the binary system (Base 2), you can represent any number using two digits: 0 and 1 Examples: 100000 2 = 32 10 1010 2 = 10 10 110110 2 = 54 10 Octal Number System In the octal system (Base 8), you can represent any number using eight digits: 0, 1, 2, 3, 4, 5, 6, and 7 Note that three binary bits are sufficient to represent any of the eight digits, as 2 3 = 8. Examples: 40 8 = 32 10 12 8 = 10 10 66 8 = 54 10 Hexadecimal Number System In the hexadecimal system (Base 16), you can represent any number using sixteen digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F Note that four binary bits are sufficient to represent any of the sixteen digits, as 2 4 = 16. Hexadecimal numbers are usually written with a 0x prefix or an h suffix, if the base is not present in the subscript. For example: 0x EF01 or F301 h or 78AB 16 Examples: 20 16 = 32 10 A 16 = 10 10 36 16 = 54 10 Prepared by: Shafaq Chaudhry
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
The first sixteen numbers in decimal, binary, hexadecimal, and octal are given below: Decimal Binary (4-bit representation) Hexadecimal Octal 0 0000 0 0 1 0001 1 1 2 0010 2 2 3 0011 3 3 4 0100 4 4 5 0101 5 5 6 0110 6 6 7 0111 7 7 8 1000 8 10 9 1001 9 11 10 1010 A 12 11 1011 B 13 12 1100 C 14 13 1101 D 15 14 1110 E 16 15 1111 F 17 Convert binary, octal, or hexadecimal to decimal How do you find the value of a binary, hexadecimal or octal number? For each digit of the number, multiply the magnitude of the digit by the place value of the digit and find the sum. The place value of a digit is equal to the base raised to a power equal to the digit’s place. Examples: 100000 2 = 1 x 2 5 + 0 x 2 4 + 0 x 2 3 + 0 x 2 2 + 0 x 2 1 + 0 x 2 0 = 32 + 0 + 0 + 0 +0 +0 = 32 10 12 8 = 1 x 8 1 + 2 x 8 0 = 8 + 2 = 10 10 36 16 = 3 x 16 1 + 6 x 16 0 = 48 + 6 = 54 10 Convert decimal to binary, octal or hexadecimal This is done by repeated division of the decimal number by the base (2, 8 or 16) you are trying to convert to. Note down all the remainders. The first remainder is the least significant bit of the converted number, the next remainder is the next significant bit, and the last remainder is the most significant bit of the converted number. Example: Convert 275 10 to octal, binary and hexadecimal representations Octal: 8 275 34 3 4 2 Prepared by: Shafaq Chaudhry Remainder
Background image of page 2
Binary: Hexadecimal: 16 275 17 3 1 1 Prepared by: Shafaq Chaudhry
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 275 137 1 68 1 34 0 17 0 8 1 4 0 2 0 1 0 Prepared by: Shafaq Chaudhry
Background image of page 4
So, 275 10 = 423 8 = 100010011 2 = 113 16 Convert Binary to Octal Replace each three-digit group to its respective octal representation. Additional 0s may
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/05/2010 for the course CIS CIS 3360 taught by Professor Guha during the Spring '10 term at University of Central Florida.

Page1 / 10

2's complement v2 - CIS 3360 Security in Computing Spring...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online