# 4new - Representation and Manipulation Information(3 1...

This preview shows pages 1–10. Sign up to view the full content.

1 Representation and Manipulation Information (3)

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

View Full Document
2 Outline Encodings Unsigned and two’s complement Conversions Signed vs. unsigned Long vs. short Suggested reading Chap 2.2
3 Unsigned Representation Binary (physical) – Bit vector [x w-1 ,x w-2 ,x w-3 , x 0 ] Binary to Unsigned (logical) B 2 U ( X ) = x i 2 i i = 0 w - 1

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

View Full Document
4 Two’s Complement Binary (physical) – Bit vector [x w-1 ,x w-2 ,x w-3 , x 0 ] Binary to Signed (logical) 2’s complement B 2 T ( X ) = - x w - 1 2 w - 1 + x i 2 i i = 0 w - 2 Sign Bit
5 From Two’s Complement to Binary If nonnegative Nothing changes If negative, its binary representation is  - = - + = 2 0 1 1 2 2 w i i w 2 2 1 1 1 w 1 0 0 0 2 2 (2 2 ) ( (1 )2 1) w w w w i w i i i i i i i i x x x x - - - - - - = = = - + = - - = - - + 0 1 2 1 x x x w -

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

View Full Document
6 Two’s Complement What does it mean? Logical value = -(~Binary + 1) ~Binary = -Logical value – 1 Binary = ~(-Logical value – 1) Binary = ~(-Logical value ) + 1 (be proved later) 2 1 1 w 1 0 0 2 2 ( (1 )2 1) w w w i i i i i i x x x - - - - = = - + = - - + ∑ ∑
7 From a Number to Two’s Complement -5 5 0101 (binary for 5) 1010  (after complement) 1011 (add 1)

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

View Full Document
8 Two’s Complement Encoding Examples Binary/Hexadecimal Representation for -12345 Binary:  0011 0000 0011 1001 (12345) Hex:           3       0      3      9 Binary:  1100 1111 1100 0110 (after complement) Hex:           C     F     C      6 Binary:  1100 1111 1100 0111 (add 1) Hex:           C     F     C      7
Numeric Range Unsigned Values

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 10/19/2011 for the course CS 000 taught by Professor Jing during the Fall '10 term at Fudan University.

### Page1 / 36

4new - Representation and Manipulation Information(3 1...

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

View Full Document
Ask a homework question - tutors are online