Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- arcSin:
- # **We will expand a power series to n = 10 given X** #
- # Initialize vars.
- la $t0, ($a0) # Sum = X
- mtc1 $t0, $f0 # Actual SUm
- mtc1 $t0, $f1 # Temp sum
- mtc1 $t0, $f11 # constant X
- li $t1, 3 # power
- li $t2, 1 # counter
- li $t3, 6
- mtc1 $t3, $f2 # divisor
- cvt.s.w $f2, $f2 # NEEDED to divide correctly
- loop: beq $t1, $t2, p3
- addi $t2, $t2, 1 # Increment counter
- mul.s $f1, $f1, $f11 # sux * x
- j loop
- loop2: beq $t1, $t2, endLoops
- addi $t2, $t2, 1 # Increment counter
- mul.s $f1, $f1, $f11 # sux * x
- j loop2
- p3:
- div.s $f1, $f1, $f2 # tempSum / 6
- add.s $f0, $f0, $f1 # sum += tempSum
- mov.s $f1, $f11 # reset tempSu
- li $t1, 5 # change the power to 5
- li $t2, 1 # resset counter
- j loop2
- endLoops:
- li $t3, 40
- mtc1 $t3, $f2 # divisor
- cvt.s.w $f2, $f2 # NEEDED to divide correctly
- div.s $f1, $f1, $f2 # tempSum / 4
- add.s $f0, $f0, $f1 # sum += tempSum
- mfc1 $a0, $f0 # radian version
- lwc1 $f1, pi
- li $t3, 180 # 180 degrees
- mtc1 $t3, $f2
- cvt.s.w $f2, $f2
- mul.s $f0, $f0, $f2
- div.s $f0, $f0, $f1
- la $a0 , angleTraj
- li $v0 , 4
- syscall
- mov.s $f12, $f0 # return summation
- li $v0, 2
- syscall
- mfc1 $s1, $f12
- la $a0 , newLine
- li $v0 , 4
- syscall
- jr $ra
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement