Created 07/03/03; edited 05/30/15

# Floating Point Comparison Instructions

Instructions: For each question, choose the single best answer. Make your choice by clicking on its button. You can change your answers at any time. When the quiz is graded, the correct answers will appear in the box after each question.

1. How does a floating point comparison instruction indicate that a certain condition is true?

 A.    It sets the condition bit to zero. B.    It sets the condition bit to one. C.    It sets a designated register to one. D.    It executes a branch.

2. Why is it often unwise to test if two floating point values are equal?

 A.    Floating point values are often approximations so equality sometimes does not occur where mathematically it should. B.    Because there is more information in testing if one value is larger than another. C.    Because equality is not defined for floating point values. D.    Because testing for equality is time consuming.

3. After the condition bit is set (or cleared), how long does it retain its value?

 A.    Forever. B.    For one instruction cycle. C.    Until it is tested in a branch instruction. D.    Until another comparison instruction changes it.

4. Which instructions branch to `label` if the contents of \$f0 are less than the contents of \$f2?

 A.    ```c.lt.s \$f0, \$f2 bc1f label ``` B.    ```c.lt.s \$f2, \$f0 bc1t label ``` C.    ```c.lt.s \$f0, \$f2 bc1t label ``` D.    ```c.le.s \$f0, \$f2 bc1t label ```

5. Which set of instructions branches to `label` if the contents of \$f0 are greater or equal to the contents of \$f2?

 A.    ```c.ge.s \$f0, \$f2 bc1t label ``` B.    ```c.lt.s \$f2, \$f0 bc1t label ``` C.    ```c.eq.s \$f0, \$f2 bc1t label c.gt.s \$f0, \$f2 bc1t label ``` D.    ```c.le.s \$f2, \$f0 bc1t label ```

6. Which of the following branches to `label` if `0.0 < x`?

 A.    ``` l.s \$f6,x li.s \$f0,0.0 c.lt.s \$f6,\$f0 bc1t label ``` B.    ``` l.s \$f6,x li.s \$f6,0.0 c.lt.s \$f0,\$f6 bc1t label ``` C.    ``` l.s \$f6,x li.s \$f0,0.0 c.lt.s \$f0,\$f6 bc1t label ``` D.    ``` li.s \$f6,x li.s \$f0,0.0 c.lt.s \$f0,\$f6 bc1t label ```

7. Which of the following branches to `label` if `0.0 < x < 10.0`?

 A.    ``` l.s \$f6,x li.s \$f0,0.0 c.lt.s \$f6,\$f0 bc1f fail li.s \$f0,10.0 c.lt.s \$f6,\$f0 bc1t label fail: . . . label: . . . ``` B.    ``` l.s \$f6,x li.s \$f0,0.0 c.lt.s \$f0,\$f6 bc1f fail li.s \$f0,10.0 c.lt.s \$f6,\$f0 bc1t label fail: . . . label: . . . ``` C.    ``` l.s \$f6,x li.s \$f0,0.0 c.lt.s \$f0,\$f6 bc1f fail li.s \$f0,10.0 c.lt.s \$f0,\$f6 bc1t label fail: . . . label: . . . ``` D.    ``` l.s \$f6,x li.s \$f0,0.0 c.le.s \$f0,\$f6 bc1f fail li.s \$f0,10.0 c.le.s \$f6,\$f0 bc1t label fail: . . . label: . . . ```

8. What is the method that is often used for computing square root?

 A.    Newton's Method B.    Cauchy's Method C.    Pascal's Method D.    Elimination Method

9. About how many decimal places of accuracy does single precision floating point have?

 A.    3 or 4 B.    4 or 5 C.    6 or 7 D.    8 or 9

10. When a floating point value is being computed in a loop, how is the loop usually ended?

 A.    After a few iterations. B.    After very many iterations. C.    When the computed value exactly matches a specified condition. D.    When the computed value falls into a specified range.

The number you got right:       Percent Correct:       Letter Grade:

If you have returned here from another page, or have re-loaded this page, you will need to click again on each of your choices for the grading program to work correctly. You may want to press the SHIFT KEY while clicking to clear the old answers.