Class 22: Integer Representation Flashcards
For using Ned addition, if carry out from most significant pair of bits is _____, there is not overflow
0
Two complements range for values
-2^(w-1) <= x,y <= 2^(w-1) -1
Unsigned min and max values
Min value: 0
Max value 2^(w) -1
Conversion from two complement to usigned
X < 0: add 2^w
X <0: just x, no change
Usinged to two complement conversion
X < 2^(w-1) : nothing
X > 2^(w-1): subtract 2^w
B2O
One complement
In B2O, the most significant digit represent the _____ _____
Sign bit
If the sign bit is ____, it is a ____a number and to get the magnitude, _____ the bits
1, negative, invert
B2S
Sign magnitude
In B2S most significant bit represents ____ bit
If sign bit is 1, it is ____ and to get the magnitude of the number, use the remaining _____ bits
Sign bit
Negative, w-1
Loss of information in truncation
When a high order w-k bits are dropped when truncating to w bit number what happens
Unsigned:
Signed:
Unsigned: if all bits dropped are 0, value is preserved
Signed: If the most significant bit in the truncated number is the same as each of the truncated buts, value is reserved
(1111) to (111)
-1. -1
Unsigned integer addition overflow
Overflow when x+y > 2^(w) -1
Singed integer addition overlord
Negative overflow: x+y < -2^(w-1)
Positive overflow: x+y > 2^(w-1)-1
Get a signed (B2T) representation of a negative value of (B2U) bit patter (unsigned)
INVERT the B2U bit pattern and add 1
Going from signed to usigned
- Convert binary to two complement
- Invert bits
- Add 1
- Interpret that binary as unsigned
Additive inverse
Value added to given number to get 0
-2^(w-1) is its own additive inverse
True
23.67 rounded to nearest
24