Assume a simple model for floating-point representation is used, the representation uses a 16-bit format, 5 bits for the exponent, with a bias of 16, a normalized significand of 8-bits, and a single sign bit for the number.

I)Show how the computer would represent the numbers [89.78] and [35.91] using this floating-point format.

II)Show how the computer would add the two floating-point numbers in part-I.

III)Show how the computer would represent the sum in part-II.

IV) What decimal value for the sum is the computer actually storing?

Homework Posting Tips

Please show your work. Tutors will not do your homework for you. Please show your work for any question that you are posting.

I) To represent the numbers [89.78] and [35.91] using the given floating-point format, we need to break them down into their binary components: sign, exponent, and significand.

For 89.78:
1) Sign: The number is positive, so the sign bit would be 0.
2) Exponent: The exponent can be calculated by finding the power of 2 that brings the number closest to 1. In this case, 89.78 is closest to 2^6 or 64, so the exponent value would be 6. However, the bias of 16 needs to be added to the exponent, so the encoded exponent would be 6 + 16 = 22.
3) Significand: The significand can be obtained by representing the non-fractional part of the number in binary. For 89, it is 1011001. The fractional part (0.78) can be converted to binary by multiplying it by 2 repeatedly until the fractional part becomes zero or until the desired precision is reached. Therefore, 0.78 in binary is 0.11001100.

Combining the components, the representation of 89.78 would be as follows:
0 010110 11001100

For 35.91:
1) Sign: The number is positive, so the sign bit would be 0.
2) Exponent: The exponent can be calculated similarly to the previous example. Here, 35.91 is closest to 2^5 or 32, so the exponent value would be 5. Adding the bias of 16, the encoded exponent would be 5 + 16 = 21.
3) Significand: The significand for 35 is 100011 and for 0.91 is 0.11101100.

Therefore, the representation of 35.91 would be:
0 010101 10001111

II) To add the two floating-point numbers, we first need to align their exponents by shifting the smaller exponent to match the larger one. In this case, we need to shift the second number (35.91) to the right by 1 bit to make its exponent equal to 22. During shifting, the significand bits need to be adjusted accordingly. The result of the addition would give the sum of the two numbers.

III) After adding the two floating-point numbers from part-II, we obtain the sum. The sum will have the same sign (positive) as the original numbers. The exponent of the sum will be equal to the exponent of the larger number since smaller numbers tend to lose precision during addition. The significand will be adjusted to reflect the sum.

IV) To determine the decimal value that the computer is actually storing, we need to reverse the steps used to encode the floating-point number. We subtract the bias (16) from the exponent and convert the significand back to decimal. Then, we multiply the significand by 2 raised to the power of the adjusted exponent. The resulting value will be the decimal value stored in the computer.