quiz 5 Flashcards
Adding integer rules
1 + 1 = 0 carry 1
1 + 0/0 + 1 = 1
0 + 0 = 0
Bit-wise flipping syntax
bar on top of the number
Signed magnitude changing the sign
Replace the sign bit with the opposite
One’s complement changing the sign
flip everything
Two’s complement changing the sign
Flip everything and add one
Single precision length?
32 bits, 1 sign bit, 23 bits significand, 8 bits exponent, bias 127
Double precision length?
64 bits, 1 sign bit, 52 bits significand, 11 bits exponent, bias 1023
Quadruple precision length?
128 bits, 1 sign bit, 112 bits significand, 15 bits exponent, bias 16383
Half precision length?
16 bits, 1 sign bit, 10 bits significand, 5 bits exponent, bias 15
Convert decimal to IEEE 754
- Determine sign bit:
o -42.625 is negative, therefore sign bit is 1. - Convert number to binary:
o 101010.101 x 2^0 - Shift point so that there is only one 1 in front of the point:
o 1.01010101 x 2^5 - Add bias to the exponent value:
o 32-bit floating point numbers, the bias is 127.
o 5 + 127 = 132 - Convert exponent to the binary system
o 132 = 10000100 - Assemble floating point number:
o 1.10000100.01010101000000000000000
Convert IEEE 754 into decimal
- 0.10000100.10111001000000000000000
- Convert exponent to decimal
o 10000100 = 132 - Subtract bias from exponent
o 132-127 = 5 - Extend mantissa by leading “1” (add a 1 to the end)
o 1.10111001000000000000000 - Shift point
o The binary point must be shifted so that the exponent becomes 0.
o If the exponent is greater than 0, the point must be moved to the right, otherwise to the left
o 110111.001000000000000000 - Convert mantissa to decimal number
o 110111.001 = 55.125