title: Require Reverse order code for the given forward order code
body: <p><strong>I need to Calculate the value of pi (single-precision) using the first k terms of Nilakantha's series added in reverse order. I have the code for forward order which is given below. Now can someone help me to get started on how to go about the reverse order?</strong></p>
  <pre><code>    li $t1, 0           # constant value of 0
      mtc1 $t1, $f0       # $f0 = current sum
      cvt.s.w $f0, $f0    # convert representation from 2's complement to IEEE float (not needed for 0)
  
      li $t1, 2           
      mtc1 $t1, $f2       # $f2 = constant value of 2
      cvt.s.w $f2, $f2    # convert representation of 2 to float
  
      li $t1, 3           
      mtc1 $t1, $f4       # $f6 = constant value of 3
      cvt.s.w $f4, $f4    # convert representation of 3 to float
  
      li $t1, 4           
      mtc1 $t1, $f6       # $f6 = constant value of 4
      cvt.s.w $f6, $f6    # convert representation of 4 to float
  
      li $t1, 0           
      mtc1 $t1, $f8       # $f8 = current numerator
      cvt.s.w $f8, $f8    # convert representation to float
  
      li $t1, 0           
      mtc1 $t1, $f10       # $f10 = current denominator
      cvt.s.w $f10, $f10   # convert representation to float
  
      li $t1, 0           
      mtc1 $t1, $f12       # $f12 = first fraction of denomintor
      cvt.s.w $f12, $f12   # convert representation to float
  
      li $t1, 0           
      mtc1 $t1, $f14      # $f14 = second fraction of denomintor
      cvt.s.w $f14, $f14   # convert representation to float
  
      li $t1, 0           
      mtc1 $t1, $f16       # $f16 = thridt fraction of denomintor
      cvt.s.w $f16, $f16   # convert representation to float
  
      li $t1, 0           
      mtc1 $t1, $f18        # $f18 = n
      cvt.s.w $f18, $f18    # convert representation to float
  
      li $t1, 1           
      mtc1 $t1, $f20        # $f12 = constant value of 1
      cvt.s.w $f20, $f20    # convert representation to float
  
      li $t1, -1           
      mtc1 $t1, $f22        # $f22 = constant value of -1
      cvt.s.w $f22, $f22    # convert representation to flaot
  
  single_forward:
      mov.s $f24, $f18
      cvt.w.s $f24, $f24
      mfc1 $t2, $f24
      andi $t3, $t2, 1
      bnez $t3, odd
  
  even:
      mul.s $f8, $f20, $f6        # current numerator when n is even
      
      mul.s $f30, $f2, $f18       # $f30 = 2n
      add.s $f12, $f30, $f2       # $f12 = (2n+2)
      add.s $f14, $f12, $f20      # $f14 = (2n+3)
      add.s $f16, $f14, $f20      # $f16 = (2n+4)
      mul.s $f10, $f12, $f14      # current denominator (2n+2)(2n+4)
      mul.s $f10, $f10, $f16      # $f10 = (2n+2)(2n+3)(2n+4)
  
      div.s $f24, $f8, $f10       # $f24 = result
      add.s $f0, $f0, $f24        # update the sum
  
      add.s $f18, $f18, $f20      # increment n counter
      mov.s $f24, $f18            # f24 = current n count
      cvt.w.s $f24, $f24          # convert representation to float
      mfc1 $t4, $f24              # 
      beq $a0, $t4, done
  
      j single_forward
      
  odd:
      mul.s $f8, $f22, $f6       # current numerator when n is odd
  
      mul.s $f30, $f2, $f18       # $f30 = 2n
      add.s $f12, $f30, $f2       # $f12 = (2n+2)
      add.s $f14, $f12, $f20      # $f14 = (2n+3)
      add.s $f16, $f14, $f20      # $f16 = (2n+4)
      mul.s $f10, $f12, $f14      # current denominator (2n+2)(2n+4)
      mul.s $f10, $f10, $f16      # $f10 = (2n+2)(2n+3)(2n+4)
  
      div.s $f24, $f8, $f10       # $f24 = result
      add.s $f0, $f0, $f24        # update the sum
  
      add.s $f18, $f18, $f20      # increment n counter
      mov.s $f24, $f18            # f24 = current n count
      cvt.w.s $f24, $f24          # convert representation to float
      mfc1 $t4, $f24              # 
      beq $a0, $t4, done
  
      j single_forward
  
  
  done:
      add.s $f0, $f0, $f4  # add 3 to result
  
      jr $ra
  </code></pre>
  <p>Any hint or suggestion to get me started will be appreciated Thank YOU!</p>