1. If Denormalization is used how many additional numbers can be represented? a.
ID: 3900768 • Letter: 1
Question
1. If Denormalization is used how many additional numbers can be represented?
a. What is the smallest positive number now?
b. What are Zero(s)?
2. Compare the above 8-bit FLP representation and 8-bit 2’s complement representation in terms of the range and accuracy of integer representations (are they both represent equal number of real numbers?).
3. Do Q3 & Q4, but assume now that the computer uses 8-bit for FLP (1bit for sign, 5 bit for exponent with excess-3 rep., rest for magnitude). Assume 00000 and 11111 in exponent field are reserved for denormalization.
4. Assume a compiler represent very small flp (say vsflp) as 8-bit .
Suppose variables W, X, Y, and Z are initialized as follows (type vsflp).
Vsflp x = 12, y = 4.5
a. How X, Y and Z will be represented?
b. Show how the following operations will be calculated by the FLP unit?
X + X, X + Y, Y + Y
c. Which of the above operations will overflow or loose precision?
d. Show how X*Y will be calculated (assume intermediate calculations will be done in 8-bit register). Write an algorithm to demonstrate this operation.
e. Show how X/Y will be calculated.
c. Show how (X / 0 ) , ( 0/ X) and ( 0 / 0 ) will be represented?
5. Consider the program below.
#include <stdio.h>
int main(void)
{
int I = 16777217;
float F = 16777216.0;
printf("The integer is: %d ", I);
printf("The float is: %f ", F);
if (I == F) printf("They are equal”);
}
What will be printed? Explain.
Explanation / Answer
5.
Answer)
#include <stdio.h>
int main(void)
{
int I = 16777217; // intialization of Integer I
float F = 16777216.0; // initialization of Float F
printf("The integer is: %d ", I); // printing the integer
printf("The float is: %f ", F); // printing the float
if (I == F) printf("They are equal”); // Comparing the two if they are equal, in this case they are.
}
What will be printed? Explain.
On executing the above code the output is:
The integer is: 16777217
The float is: 16777216.000000
They are equal
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.