In: Computer Science
1) Using IEEE 754 format, determine the number this represents:
(64 bits) 0 11000111010 1100110000000100000000000000100000000000000000000000
2) Using complement two:
a) Represent 127
b) 127 – 499
3) How many nibbles can fit in three Word?
4) Using complement one:
a) What number represents 10001111?
1) 0 11000111010 1100110000000100000000000000100000000000000000000000 sign bit is 0(+ve) exp bits are 11000111010 Converting 11000111010 to decimal 11000111010 => 1x2^10+1x2^9+0x2^8+0x2^7+0x2^6+1x2^5+1x2^4+1x2^3+0x2^2+1x2^1+0x2^0 => 1x1024+1x512+0x256+0x128+0x64+1x32+1x16+1x8+0x4+1x2+0x1 => 1024+512+0+0+0+32+16+8+0+2+0 => 1594 in decimal it is 1594 so, exponent/bias is 1594-1023 = 571 frac bits are 11001100000001000000000000001 IEEE-754 Decimal value is 1.frac * 2^exponent IEEE-754 Decimal value is 1.11001100000001000000000000001 * 2^571 1.11001100000001000000000000001 in decimal is 1.7969360370188951 => 1.11001100000001000000000000001 => 1x2^0+1x2^-1+1x2^-2+0x2^-3+0x2^-4+1x2^-5+1x2^-6+0x2^-7+0x2^-8+0x2^-9+0x2^-10+0x2^-11+0x2^-12+0x2^-13+1x2^-14+0x2^-15+0x2^-16+0x2^-17+0x2^-18+0x2^-19+0x2^-20+0x2^-21+0x2^-22+0x2^-23+0x2^-24+0x2^-25+0x2^-26+0x2^-27+0x2^-28+1x2^-29 => 1x1+1x0.5+1x0.25+0x0.125+0x0.0625+1x0.03125+1x0.015625+0x0.0078125+0x0.00390625+0x0.001953125+0x0.0009765625+0x0.00048828125+0x0.000244140625+0x0.0001220703125+1x6.103515625e-05+0x3.0517578125e-05+0x1.52587890625e-05+0x7.62939453125e-06+0x3.814697265625e-06+0x1.9073486328125e-06+0x9.5367431640625e-07+0x4.76837158203125e-07+0x2.384185791015625e-07+0x1.1920928955078125e-07+0x5.960464477539063e-08+0x2.9802322387695312e-08+0x1.4901161193847656e-08+0x7.450580596923828e-09+0x3.725290298461914e-09+1x1.862645149230957e-09 => 1+0.5+0.25+0.0+0.0+0.03125+0.015625+0.0+0.0+0.0+0.0+0.0+0.0+0.0+6.103515625e-05+0.0+0.0+0.0+0.0+0.0+0.0+0.0+0.0+0.0+0.0+0.0+0.0+0.0+0.0+1.862645149230957e-09 => 1.7969360370188951 so, 1.7969360370188951 * 2^571 in decimal is 1.3888653483042899e+172 so, 0110001110101100110000000100000000000000100000000000000000000000 in 64-bit format is 1.3888653483042899e+172 Answer: 1.3888653483042899e+172 2) a) Using 16-bits for 2's complement representation Number: 127 Let's convert this to two's complement binary 127 Since this is a positive number. we can directly convert this into binary Divide 127 successively by 2 until the quotient is 0 > 127/2 = 63, remainder is 1 > 63/2 = 31, remainder is 1 > 31/2 = 15, remainder is 1 > 15/2 = 7, remainder is 1 > 7/2 = 3, remainder is 1 > 3/2 = 1, remainder is 1 > 1/2 = 0, remainder is 1 Read remainders from the bottom to top as 1111111 So, 127 of decimal is 1111111 in binary so, 127 in 2's complement binary is 0000000001111111 Number: -499 Let's convert this to two's complement binary -499 This is negative. so, follow these steps to convert this into a 2's complement binary Step 1: Divide 499 successively by 2 until the quotient is 0 > 499/2 = 249, remainder is 1 > 249/2 = 124, remainder is 1 > 124/2 = 62, remainder is 0 > 62/2 = 31, remainder is 0 > 31/2 = 15, remainder is 1 > 15/2 = 7, remainder is 1 > 7/2 = 3, remainder is 1 > 3/2 = 1, remainder is 1 > 1/2 = 0, remainder is 1 Read remainders from the bottom to top as 111110011 So, 499 of decimal is 111110011 in binary So, 499 in normal binary is 0000000111110011 Step 2: flip all the bits. Flip all 0's to 1 and all 1's to 0. 0000000111110011 is flipped to 1111111000001100 Step 3:. Add 1 to above result 1111111000001100 + 1 = 1111111000001101 so, -499 in 2's complement binary is 1111111000001101 b) 127 - 499 = 127 + (-499) Adding 127 and -499 Adding 0000000001111111 and 1111111000001101 in binary 0000000001111111 1111111000001101 --------------------- (0)1111111010001100 --------------------- Sum does not produces a carry So, sum of these numbers in binary is 1111111010001100 Verification: --------------- sum = 1111111010001100 since left most bit is 1, this number is negative number. so, follow these steps below to convert this into a decimal value. I. first flip all the bits. Flip all 0's to 1 and all 1's to 0. 1111111010001100 is flipped to 0000000101110011 II. Add 1 to above result 0000000101110011 + 1 = 0000000101110100 III. Now convert this result to decimal value Converting 101110100 to decimal 101110100 => 1x2^8+0x2^7+1x2^6+1x2^5+1x2^4+0x2^3+1x2^2+0x2^1+0x2^0 => 1x256+0x128+1x64+1x32+1x16+0x8+1x4+0x2+0x1 => 256+0+64+32+16+0+4+0+0 => 372 Answer: -372 This is correct since we can verify that 127+-499 = -372 So, there was no overflow. 3) nibble = 4 bits word = 16 bits number of nibbles in a word = 16/4 = 4 Answer: 4 4) 10001111 since left most bit is 1, this number is negative number. so, follow these steps below to convert this into a decimal value. I. first flip all the bits. Flip all 0's to 1 and all 1's to 0. 10001111 is flipped to 01110000 II. Now convert this result to decimal value Converting 1110000 to decimal 1110000 => 1x2^6+1x2^5+1x2^4+0x2^3+0x2^2+0x2^1+0x2^0 => 1x64+1x32+1x16+0x8+0x4+0x2+0x1 => 64+32+16+0+0+0+0 => 112 Answer: -112