Module 9
Convert the following RPN expression to infix: a b + c * d -
((a + b) * c) - d
Convert the following RPN expression to infix: ab+c/de+fg-h*+*
(a + b) / c * ((d + e) + ((f - g) * h))
Convert the following RPN expression to infix: a b − c /
(a − b) / c
Let a = 5, b = 7, c = 4, d = 2, e = 3, f = 1, g = 6. a b + c + d e * f / g - *
0
Which of the following postfix expressions corresponds to the given infix expression? 1 + 2 * (4 - 2) / 4 ^ (1 + 1)
1 2 4 2 - * 4 1 1 + ^ / +
What is the size of the FPU stack registers?
10 bytes, or 80 bits.
Let a = 5, b = 7, c = 4, d = 2, e = 3, f = 1, g = 6. a b + c - d *
16
Find the decimal value of the postfix (RPN) expression. Round answers to one decimal place (e.g. for an answer of 13.45 you would enter 13.5): 3 8 3 - * 3 6 / 4 * +
17
Which of the following infix expressions corresponds to the given postfix expression? 2 3 ^ 5 4 * / 10 + 2 ^ 3 / 5 * (4 + 10) 2 ^ 3 / (5 * 4) + 10 2 ^ (3 / (5 * 4)) + 10 2 ^ 3 / 5 * 4 + 10
2 ^ 3 / (5 * 4) + 10
Which of the following infix expressions corresponds to the given postfix expression? 3 4 - 3 2 4 2 - + ^ - 3 - (4 - 3) ^ (2 + 4 - 2) 3 - 4 - (3 ^ (2 + 4 - 2)) 3 - (4 - 3) ^ (2 + 4 - 2) 3 - 4 - (3 ^ (2 + 4)) - 2
3 - 4 - (3 ^ (2 + 4 - 2))
Which of the following infix expressions corresponds to the given postfix expression? 4 5 + 5 ^ 3 4 / - (4 + 5) ^ (5 - 3) / 4 4 + 5 ^ 5 - 3 / 4 4 + 5) ^ 5 - 3 / 4 (4 + 5) ^ 5 / 3 - 4
4 + 5) ^ 5 - 3 / 4
Let a = 5, b = 7, c = 4, d = 2, e = 3, f = 1, g = 6. Evaluate the following RPN expressions. a b c + *
55
Which of the following postfix expressions corresponds to the given infix expression? 56 / (42 * 4 * 2) + (256 / (128 - 64)) * 3 ^ 12 56 42 4 * 2 * / 256 128 64 - 3 12 / ^ * + 56 42 4 * 2 * / 256 128 64 - / 3 12 ^ * + 56 42 4 * 2 * 256 /128 64 - / 3 12 ^ * + 56 42 4 * 2 * / 256 128 64 - / 3 12 * ^ +
56 42 4 * 2 * / 256 128 64 - / 3 12 ^ * +
Find the decimal value of the postfix (RPN) expression. Round answers to one decimal place (e.g. for an answer of 13.45 you would enter 13.5): 6 4 + 7 6 - * 5 / 6 +
8
Which instruction is used to convert an integer value to float and push it onto the FPU stack? FLD FIPUSH FILD FINIT
FILD
How is the FILD instruction different than FLD ?
FILD will convert an integer value to float before pushing it on the FPU stack. FLD assumes the provided value is already a float.
Which instruction is used to initialize the FPU? FST FINIT FLD FILD
FINIT
Implement the statement floating point calculation H = (A / (B + C)) * ((D - E) + (F / G)) in MASM code. It's not necessary to write a complete program or procedure, just write the FPU code fragment.
FINIT FLD A FLD B FLD C FADD FDIV FLD D FLD E FSUB FLD F FLD G FDIV FADD FMUL FSTP H
Which of the following FPU manipulations corresponds to the given infix notation? Z = A * (B / (C - D)) - E FINIT FLD A FLD B FMUL FLD C FDIV FLD D FLD E FSUB FSUB FSTP Z FINIT FLD A FLD B FLD C FDIV FMUL FLD D FSUB FLD E FSUB FSTP Z FINIT FLD A FLD B FLD C FLD D FSUB FDIV FMUL FLD E FSUB FSTP Z
FINIT FLD A FLD B FLD C FLD D FSUB FDIV FMUL FLD E FSUB FSTP Z
Write an instructions loads a duplicate of ST(0) onto the FPU stack
FLD ST(0)
How is the FSTP instruction different than FST ?
FST will copy the value in ST(0) into a memory location (or stack register), while FSTP will do that, and also remove the copied value from the FPU stack.
The IA-32 FPU FLD instruction can only load in REAL10 floats, not REAL4 or REAL8.
False
The IA-32 FPU is directly connected to the ALU via internal bus.
False
A 0-address FPU instruction will have how many operands?
None
List some FPU instructions which accept immediate operands.
None
(True/False) It is possible to to push integer values to the FPU stack
Special Integers must be converted to floats before they can be on the stack, but this conversion is handled by the FPU instructions beginning with FI
Which of the following infix notations corresponds to the given FPU manipulations? FINIT FLD A FLD B FLD C FSUB FLD D FLD E FMUL FDIV FADD FSTP Z Z = (A + B - C) / (D * E) Z = A + (B - C) / D * E Z = A + (B - C) / (D * E) Z = A + B - C / (D * E)
Z = A + (B - C) / (D * E)
Which of the following infix notations corresponds to the given FPU manipulations? FINIT FLD A FLD B FLD C FSUB FLD D FLD E FMUL FDIV FADD FSTP Z Z = A + (B - C) / (D * E) Z = A + (B - C) / D * E Z = A + B - C / (D * E) Z = (A + B - C) / (D * E)
Z = A + (B - C) / (D * E)
Convert the following infix expression to RPN: (a + b) * (c + d)
a b + c d + *
Convert the following infix expression to postfix :a + ((b * c) - d) / (e + f)
a b c * d - e f + / +
Convert the following infix expression to postfix: a + ((b * c) - d) / (e + f)
a b c * d - e f + / +
Convert the following infix expression to RPN: (a * (b + c)) / (d - (e * f))
a b c + * d e f * - /
Convert the following infix expression to RPN: a + b / c * d + e * f - g * h
a b c / d * + e f * + g h * -