In: Computer Science
Solution:
a) What is the valid range of values for the biased exponent E? -126 to ______
The valid range of values for the biased exponent E is from -126 to +127. These values are for single-precision floating-point representation i.e. for 32-bit number.
b) What is the biased exponent E for denormalized values?
A denormal number is represented with a biased exponent of all 0 bits, this represents a value -126. The smallest biased exponent representing a normal number is 1
c)
Infinity is represented with all 1's in the exponent and all 0's in the fraction part. For negative infinity, the sign bit is 1 and for positive infinity, the sign bit is 0.
Zero is indicated with all 0's in the exponent and fraction. For positive 0, the sign bit is 0.
Floating-point exception results if the computation is not a number. For representing these kinds of results we use the Not-a-Number format. It is represented either 0/1 in sign bit, all 1's in the exponent field, and anything other than all 0's in the fraction field.
Representation of 3.5:
(representation of floating-point numbers: 1 sign bit, 8 bits of exponent field, 23 bits of mantissa field.)
3 in binary is 011, 0.5 in binary is 1. Concatenating the result: 11.1 is the binary representation of 3.5
as this is +ve number, the sign bit is 0. 11.1 is represented as 1.11 * 2^1. This indicates, the exponent is 1 i.e 127+1 which is 128. 11 is the mantissa field.
Representation of 128 in binary is 10000000
The mantissa is 11, and its representation is 11000000000000000000000.
So the result is 01000000011000000000000000000000
So for 3.5 the result is 01000000011000000000000000000000
Representation of -3.5:
The result is exactly the same as 3.5 except that the sign bit indicates the value as -ve. So the sign bit is 1 in this case.
So the result is 11000000011000000000000000000000
Representation of 7.0:
(representation of floating-point numbers: 1 sign bit, 8 bits of exponent field, 23 bits of mantissa field.)
7 in binary is 111, 0.0 in binary is 0. Concatenating the result: 111.0 is the binary representation of 7.0
as this is +ve number, the sign bit is 0. 111.0 is represented as 1.11 * 2^2. This indicates, the exponent is 1 i.e 127+2 which is 129. 11 is the mantissa field.
Representation of 129 in binary is 10000001
The mantissa is 11, and its representation is 11000000000000000000000.
So the result is 01000000111000000000000000000000
So for 7.0 the result is 01000000111000000000000000000000
Representation of -7.0:
The result is exactly the same as 7.0 except that the sign bit indicates the value as -ve. So the sign bit is 1 in this case.
So the result is 11000000111000000000000000000000