18. If the floating-point number storage on a certain system has a sign bit, a 3-bit exponent, and a 4-bit significand:
a) What is the largest positive and the smallest negative number that can be stored on this system if the storage is normalized? (Assume no bits are implied, there is no biasing, exponents use two’s complement notation, and exponents of all zeros and all ones are allowed.)
b) What bias should be used in the exponent if we prefer all exponents to be nonnegative? Why would you choose this bias?
a)
To determine the largest positive and smallest negative number that can be stored on the system, we need to consider the format and range of the floating-point representation.
Given the format:
For normalized representation, the leading bit of the significand is assumed to be 1.
Largest positive number: To obtain the largest positive number, we need the maximum exponent and the maximum significand.
Assuming the exponent is in two's complement notation, the maximum exponent value in binary is 011
(3 bits with all ones).
The maximum significand value is obtained by setting all 4 bits to 1. Therefore, the largest positive number is represented as:
Sign: 0 (positive) Exponent: 011 Significand: 1111
Smallest negative number: To obtain the smallest negative number, we need the minimum exponent (negative value) and the minimum significand.
Assuming the exponent is in two's complement notation, the minimum exponent value in binary is 100
(3 bits with all zeros). The minimum significand value is obtained by setting all 4 bits to 0.
Therefore, the smallest negative number is represented as:
Sign: 1 (negative) Exponent: 100 Significand: 0000
b)
Using a bias of 4 allows us to represent the range from -4 to 3 as nonnegative values (0 to 7) in the 3-bit exponent field. This simplifies comparisons, calculations, and other operations on the exponents.