Question: 1. Suppose the compiler in Q5 also implements a data type int using 8-bit 2s complement representation. Explain how the variables W, X, Y and
1. Suppose the compiler in Q5 also implements a data type int using 8-bit 2s complement representation. Explain how the variables W, X, Y and Z of type vsint will be converted to int type (type promotion, implicit casting or coercion).
Quesion number 5( Assume a compiler represent very small integers (say vsint) as 4-bit (nibble) 2s complement numbers.
What is the range of vsint?
Suppose variables W, X, Y, and Z are initialized as follows (type vsint).
vsint W = -1, X = 3, Y = 6, Z = -6
How X, Y and Z will be represented?
Show how the following operations will be calculated by a 4-bit ALU?
X + X, X + Y, X + Z, W + Z, Z + Z, X Y, Y X, Z X , X Z and W Z
Which of the above operations will overflow?
Show how X*Y and X*Z will be calculated (assume intermediate calculations will be done in 8-bit register). Write an algorithm to demonstrate this operation.
Show how Y/X and Z/X will be calculated.)
2. Explain how X*Y and X*Z will be calculated if 4-bit Twos compliment is used by the compiler (assume intermediate calculations can use 8-bits)
3. Consider the following program. What was printed in the second line? Explain.
Floating Point Representations
4. Explain IEEE representation for 32-bit FLP (single- precision).
5. Explain how Denormalization is used to represent zeros, Infinity, NaaN and some more small fractions.
6. The following problem is used to demonstrate the limitation of FLP in computers.
A computer uses 8-bit for FLP (1bit for sign, 3 bit for exponent with excess-3 rep., rest for fraction). Assume 000 and 111 in exponent field are reserved.
a. What is 11000000?
b. How 1 will be represented?
c. What is the smallest positive number in this representation? (without denormal)
d. What is the maximum number?
e. What is the smallest negative number? (without denormal)
f. What is the minimum number?
g. How 0.2 will be represented?
h. How 0 will be represented.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
