Lecture1000-4

# Lecture1000-4 - Options 1scomplement...

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

1 Signed-Integer Representation Signed-Integer Representation No obvious direct way to represent the  sign in binary notation Options: Sign-and-magnitude representation 1’s complement 2’s complement (most common)

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

View Full Document
2 Sign-and-Magnitude Sign-and-Magnitude Use left-most bit for sign 0 = plus; 1 = minus Total range of integers the same Half of integers positive; half negative Magnitude of largest integer half as large Example using 8 bits: Unsigned:  1111 1111 = +255 Signed:     0111 1111 = +127       1111 1111 = -127 Note:  2 values for 0:  +0 (0000 0000) and -0 (1000 0000)
3 Calculation Algorithms Calculation Algorithms Sign-and-magnitude algorithms complex and difficult  to implement in hardware Must test for 2 values of 0 Useful with BCD Order of signed number and carry/borrow makes a difference Example:  Decimal addition algorithm Addition:  2 Positive Numbers Addition:  1 Signed Number    4 +2    6 4 - 2    2 2 - 4 -2 12 - 4 8

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

View Full Document
4 Ranges Ranges No. of bits Binary Unsigned Sign-magnitude Min Max Min Max 1 0 1 2 0 3 -1 1 3 0 7 -3 3 4 0 15 -7 7 5 0 31 -15 15 6 0 63 -31 31
5 Ranges: General Rule Ranges: General Rule No. of bits Binary Unsigned Sign-magnitude Min Max Min Max n 0 2 n  - 1 -(2 n -1   - 1) 2 n -1   - 1

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

View Full Document
6 Complementary Representation Complementary Representation Sign of the number does not have to be  handled separately Consistent for all different signed  combinations of input numbers Two methods Radix : value used is the base number Diminished radix : value used is the base  number minus 1 9’s complement: base 10 diminished radix  1’s complement: base 2 diminished radix
7 9’s Decimal Complement 9’s Decimal Complement Complement representation :  (1) positive number: remains itself; (2)  negative number: subtracting its absolute value from a standard basis  value Decimal (base 10) system:  diminished radix  complement  Radix minus 1 = 10 – 1         9 as the basis  3-digit example: base value = 999 Range of possible values 0 to 999 arbitrarily split at 500 Numbers Negative Positive Representation method Complement  Number itself Range of decimal numbers -499 -000 +0 499 Calculation 999 minus abs(number) none Representation example 500 999   0 499     –   Increasing value + 999 499

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

View Full Document
8 9’s Decimal Complement 9’s Decimal Complement Necessary to specify number of digits or  word  size 9’s complement representation in “999” base Example : representation of 3-digit number  First digit = 0 through 4     positive number First digit = 5 through 9     negative number
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 34

Lecture1000-4 - Options 1scomplement...

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

View Full Document
Ask a homework question - tutors are online