49.4k views
3 votes
Assume the following representation for a floating point number 1 sign bit, 4 bits exponent, 4 bits for the significand, and a bias of 7 for the exponent (there is no implied 1 as in IEEE).

a) What is the largest positive number (in binary) that can be stored? Estimate it in decimal.
b) What is the smallest positive number (closest to 0) that can be stored in binary? Estimate it in decimal.
c) Describe the steps for adding two floating point numbers.
d) Describe the steps for multiplying two floating point numbers.

User Peekmo
by
7.7k points

1 Answer

6 votes

Final answer:

In a given floating point representation, the largest positive number can be stored by setting the sign bit to 0, the exponent to the maximum value, and the significand to all 1's. The smallest positive number can be stored by setting the sign bit to 0, the exponent to the minimum value, and the significand to all 0's. Adding two floating point numbers involves normalizing the numbers, aligning the exponents, adding the significands, normalizing the result if necessary, and rounding the result. Multiplying two floating point numbers involves multiplying the significands, adding the exponents, normalizing the result if necessary, and rounding the result.

Step-by-step explanation:

a) The largest positive number that can be stored in the given floating point representation is when the sign bit is 0, the exponent is the maximum value (15), and the significand is all 1's. So in binary, the number is 0 1111 1111. This can be converted to decimal by using the formula (-1)^0 * (1 + significand) * 2^(exponent - bias), which gives us (-1)^0 * (1 + (15/16)) * 2^(15 - 7) = 2047.

b) The smallest positive number that can be stored in the given representation is when the sign bit is 0, the exponent is the minimum value (0), and the significand is all 0's. So in binary, the number is 0 0000 0000. This can be converted to decimal by using the formula (-1)^0 * (1 + significand) * 2^(exponent - bias), which gives us (-1)^0 * (1 + (0/16)) * 2^(0 - 7) = 0.03125.

c) The steps for adding two floating point numbers are as follows:

Normalize the numbers by shifting the significand until the leftmost bit is 1.

Align the exponents by shifting the smaller exponent to match the larger exponent.

Add the significands together.

Normalize the result if necessary.

Round the result to the desired precision.

d) The steps for multiplying two floating point numbers are as follows:

Multiply the significands together.

Add the exponents together.

Normalize the result if necessary.

Round the result to the desired precision.

User Shayan Shafiq
by
8.0k points