Exam 1 Answers: Section 59

 

  1. smallest number: 1.000 0000 0000 0000 0000 0001 * 2-127
    


  2. Underflow occurs when a number is too small in magnitude to fit into a floating point number. There are some numbers close to zero that cannot be represented in floating point because the exponent is too small. These are the numbers x where |x| <= (min significand) * 2min exponent. An attempt to represent a number in that range results in an underflow.


  3. smallest number: 000 0000 0000 00002 or 010
    largest number:  111 1111 1111 11112 or 3276710
    
    1.      - 472.84210 = - 111011000.1101012
                     = - 1.110110001101012 * 28
           IEEE format: 1 1000 0111 110 1100 0110 1010 0000 0000
           
    2.      0.0458510 = 0.000010112
                     = 1.0112 * 2-5
           IEEE format: 0 0111 1010 011 0000 0000 0000 0000 0000
           

    1.      0 1000 1000 010 0110 1001 1100 0000 0000
      	 = 1.01001101001112 * 29
                     = 1010011010.01112
                     = (2 + 8 + 16 + 128 + 512 + .25 + .125 + .0625)10
                     = 666.437510
           
    2.      1 0111 1011 011 0000 0000 0000 0000 0000
      	 = - 1.0112 *  2-4
                     = - 0.00010112
                     = - (.0625 + .015625 + .0078125)10
                     = - .085937510
           

  4.     check bits:
          C1   0
          C2   1
          C4   0
          C8   0
    
        stored word: 1010 0100 0110
    
    1.      fetched word: 1101 0011 1011
           fetched check bits:
              C1 = 1
              C2 = 1
              C4 = 1
              C8 = 0
           recalculated check bits:
              C1 = 1
              C2 = 0
              C4 = 1
              C8 = 1
           syndrome:
              1010
           error in d6, position 1010
      
    2.      fetched word: 0110 1111 1110
           fetched check bits:
              C1 = 0
              C2 = 1
              C4 = 1
              C8 = 1
           recalculated check bits:
              C1 = 0
              C2 = 1
              C4 = 1
              C8 = 0
           syndrome:
              1000
           error in c8, position 1000
      
  5. Two errors


  6. $t1 = 4, $t2 = 1, $t7 = 100


  7.        sub.s    $f4, $f4, $f4            # $f4 = 0 to use in check for loop end
           sub.s    $f5, $f5, $f5            # $f5 = 0 to initialize sum
      loop:
           la       $a0, prompt              # prepare to print prompt
           li       $v0, 4
           syscall                           # print prompt
           li       $v0, 6                   # prepare to read float
           syscall                           # read float
           c.eq.s   $f0, $f4                 # if user entered 0
           bc1t     loopend                  #    exit loop
           add.s    $f5, $f5, $f0            # add num to sum
           b        loop                     # back to top of loop
      loopend:
           la       $a0, maxmsg              # prepare to print sum msg
           li       $v0, 4
           syscall                           # print sum  msg
           mov.s    $f12, $f2                # prepare to print sum
           li       $v0, 2
           syscall                           # print sum
           li       $v0, 10
           syscall                           # exit from program
    


Email Me | Office Hours | My Home Page | Department Home | MCC Home Page

© Copyright Emmi Schatz 2023