Assume we are using the simple model for floating-point
representation as given in the book (the representation uses a
14-bit format, 5 bits for the exponent with a bias of 16, a
normalized mantissa of 8 bits, and a single sign bit for the
number). Show how the computer would represent the numbers 96.5 and
-0.75 using this floating-point format. [10]
a) Converting 96.5 to binary Convert decimal part first, then the fractional part > First convert 96 to binary Divide 96 successively by 2 until the quotient is 0 > 96/2 = 48, remainder is 0 > 48/2 = 24, remainder is 0 > 24/2 = 12, remainder is 0 > 12/2 = 6, remainder is 0 > 6/2 = 3, remainder is 0 > 3/2 = 1, remainder is 1 > 1/2 = 0, remainder is 1 Read remainders from the bottom to top as 1100000 So, 96 of decimal is 1100000 in binary > Now, Convert 0.50000000 to binary > Multiply 0.50000000 with 2. Since 1.00000000 is >= 1. then add 1 to result > This is equal to 1, so, stop calculating 0.5 of decimal is .1 in binary so, 96.5 in binary is 1100000.1 96.5 in simple binary => 1100000.1 so, 96.5 in normal binary is 1100000.1 => 1.1000001 * 2^6 14-bit format: -------------------- sign bit is 0(+ve) exp bits are (16+6=22) => 10110 Divide 22 successively by 2 until the quotient is 0 > 22/2 = 11, remainder is 0 > 11/2 = 5, remainder is 1 > 5/2 = 2, remainder is 1 > 2/2 = 1, remainder is 0 > 1/2 = 0, remainder is 1 Read remainders from the bottom to top as 10110 So, 22 of decimal is 10110 in binary frac bits are 10000010 so, 96.5 in 14-bit format is 0 10110 10000010 b) Converting 0.75 to binary Convert decimal part first, then the fractional part > First convert 0 to binary Divide 0 successively by 2 until the quotient is 0 Read remainders from the bottom to top as So, 0 of decimal is in binary > Now, Convert 0.75000000 to binary > Multiply 0.75000000 with 2. Since 1.50000000 is >= 1. then add 1 to result > Multiply 0.50000000 with 2. Since 1.00000000 is >= 1. then add 1 to result > This is equal to 1, so, stop calculating 0.75 of decimal is .11 in binary so, 0.75 in binary is .11 -0.75 in simple binary => .11 so, -0.75 in normal binary is .11 => 1.1 * 2^-1 14-bit format: ---------------- sign bit is 1(-ve) exp bits are (16-1=15) => 01111 Divide 15 successively by 2 until the quotient is 0 > 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 1111 So, 15 of decimal is 1111 in binary frac bits are 10000000 so, -0.75 in 14-bit format is 1 01111 10000000
Get Answers For Free
Most questions answered within 1 hours.